Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 7904ffd

Browse files
committed
Pass isHidden to createUser function and send to the hook as well.
1 parent d40120e commit 7904ffd

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

core/src/core/classes/class.AuthService.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -772,13 +772,14 @@ public static function updatePassword($userId, $userPass)
772772
* @param $userId
773773
* @param $userPass
774774
* @param bool $isAdmin
775+
* @param bool $isHidden
775776
* @return null
776777
* @todo the minlength check is probably causing problem with the bridges
777778
*/
778-
public static function createUser($userId, $userPass, $isAdmin=false)
779+
public static function createUser($userId, $userPass, $isAdmin=false, $isHidden=false)
779780
{
780781
$userId = self::filterUserSensitivity($userId);
781-
AJXP_Controller::applyHook("user.before_create", array($userId, $userPass, $isAdmin));
782+
AJXP_Controller::applyHook("user.before_create", array($userId, $userPass, $isAdmin, $isHidden));
782783
if (!ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth") && $userId == "guest") {
783784
throw new Exception("Reserved user id");
784785
}
@@ -791,18 +792,18 @@ public static function createUser($userId, $userPass, $isAdmin=false)
791792
$authDriver = ConfService::getAuthDriverImpl();
792793
$confDriver = ConfService::getConfStorageImpl();
793794
$authDriver->createUser($userId, $userPass);
794-
$user = null;
795+
$user = $confDriver->createUserObject($userId);
795796
if ($isAdmin) {
796-
$user = $confDriver->createUserObject($userId);
797797
$user->setAdmin(true);
798798
$user->save("superuser");
799799
}
800+
if($isHidden){
801+
$user->setHidden(true);
802+
$user->save("superuser");
803+
}
800804
if ($authDriver->getOptionAsBool("TRANSMIT_CLEAR_PASS")) {
801805
$realm = ConfService::getCoreConf("WEBDAV_DIGESTREALM");
802806
$ha1 = md5("{$userId}:{$realm}:{$userPass}");
803-
if (!isSet($user)) {
804-
$user = $confDriver->createUserObject($userId);
805-
}
806807
$wData = $user->getPref("AJXP_WEBDAV_DATA");
807808
if(!is_array($wData)) $wData = array();
808809
$wData["HA1"] = $ha1;

core/src/plugins/action.share/class.ShareCenter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,7 +1922,7 @@ public function createSharedRepository($httpVars, $repository, $accessDriver, $u
19221922
}
19231923
if(!isSet($httpVars["minisite"])){
19241924
// This is an explicit user creation - check possible limits
1925-
AJXP_Controller::applyHook("user.before_create", array($userName));
1925+
AJXP_Controller::applyHook("user.before_create", array($userName, null, false, false));
19261926
$limit = $loggedUser->personalRole->filterParameterValue("core.conf", "USER_SHARED_USERS_LIMIT", AJXP_REPO_SCOPE_ALL, "");
19271927
if (!empty($limit) && intval($limit) > 0) {
19281928
$count = count(ConfService::getConfStorageImpl()->getUserChildren($loggedUser->getId()));
@@ -1932,7 +1932,7 @@ public function createSharedRepository($httpVars, $repository, $accessDriver, $u
19321932
}
19331933
}
19341934
}
1935-
AuthService::createUser($userName, $pass);
1935+
AuthService::createUser($userName, $pass, false, isSet($httpVars["minisite"]));
19361936
$userObject = $confDriver->createUserObject($userName);
19371937
$userObject->personalRole->clearAcls();
19381938
$userObject->setParent($loggedUser->id);

0 commit comments

Comments
 (0)