/** * @param Repository $repository * @param AbstractAjxpUser $user * @return Array */ protected function buildIndexLockKey($repository, $user) { $scope = $repository->securityScope(); $key = $repository->getId(); if ($scope == "USER") { $key .= "-" . $user->getId(); } else { if ($scope == "GROUP") { $key .= "-" . ltrim(str_replace("/", "__", $user->getGroupPath()), "__"); } } return $key; }
/** * @param AbstractAjxpUser $parentUser * @param string $userName * @param string $password * @param bool $isHidden * @param string $display * @return AbstractAjxpUser * @throws Exception */ public function createNewUser($parentUser, $userName, $password, $isHidden, $display) { $confDriver = ConfService::getConfStorageImpl(); if (ConfService::getAuthDriverImpl()->getOptionAsBool("TRANSMIT_CLEAR_PASS")) { $pass = $password; } else { $pass = md5($password); } if (!$isHidden) { // This is an explicit user creation - check possible limits AJXP_Controller::applyHook("user.before_create", array($userName, null, false, false)); $limit = $parentUser->mergedRole->filterParameterValue("core.conf", "USER_SHARED_USERS_LIMIT", AJXP_REPO_SCOPE_ALL, ""); if (!empty($limit) && intval($limit) > 0) { $count = count($confDriver->getUserChildren($parentUser->getId())); if ($count >= $limit) { $mess = ConfService::getMessages(); throw new Exception($mess['483']); } } } AuthService::createUser($userName, $pass, false, $isHidden); $userObject = $confDriver->createUserObject($userName); $userObject->personalRole->clearAcls(); $userObject->setParent($parentUser->getId()); $userObject->setGroupPath($parentUser->getGroupPath()); $userObject->setProfile("shared"); if ($isHidden) { $userObject->setHidden(true); $userObject->personalRole->setParameterValue("core.conf", "USER_DISPLAY_NAME", $display); } AJXP_Controller::applyHook("user.after_create", array($userObject)); return $userObject; }