@@ -772,13 +772,14 @@ public static function updatePassword($userId, $userPass)
772
772
* @param $userId
773
773
* @param $userPass
774
774
* @param bool $isAdmin
775
+ * @param bool $isHidden
775
776
* @return null
776
777
* @todo the minlength check is probably causing problem with the bridges
777
778
*/
778
- public static function createUser ($ userId , $ userPass , $ isAdmin =false )
779
+ public static function createUser ($ userId , $ userPass , $ isAdmin =false , $ isHidden = false )
779
780
{
780
781
$ 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 ));
782
783
if (!ConfService::getCoreConf ("ALLOW_GUEST_BROWSING " , "auth " ) && $ userId == "guest " ) {
783
784
throw new Exception ("Reserved user id " );
784
785
}
@@ -791,18 +792,18 @@ public static function createUser($userId, $userPass, $isAdmin=false)
791
792
$ authDriver = ConfService::getAuthDriverImpl ();
792
793
$ confDriver = ConfService::getConfStorageImpl ();
793
794
$ authDriver ->createUser ($ userId , $ userPass );
794
- $ user = null ;
795
+ $ user = $ confDriver -> createUserObject ( $ userId ) ;
795
796
if ($ isAdmin ) {
796
- $ user = $ confDriver ->createUserObject ($ userId );
797
797
$ user ->setAdmin (true );
798
798
$ user ->save ("superuser " );
799
799
}
800
+ if ($ isHidden ){
801
+ $ user ->setHidden (true );
802
+ $ user ->save ("superuser " );
803
+ }
800
804
if ($ authDriver ->getOptionAsBool ("TRANSMIT_CLEAR_PASS " )) {
801
805
$ realm = ConfService::getCoreConf ("WEBDAV_DIGESTREALM " );
802
806
$ ha1 = md5 ("{$ userId }: {$ realm }: {$ userPass }" );
803
- if (!isSet ($ user )) {
804
- $ user = $ confDriver ->createUserObject ($ userId );
805
- }
806
807
$ wData = $ user ->getPref ("AJXP_WEBDAV_DATA " );
807
808
if (!is_array ($ wData )) $ wData = array ();
808
809
$ wData ["HA1 " ] = $ ha1 ;
0 commit comments