diff options
author | Jakob Sack <kde@jakobsack.de> | 2011-04-18 11:48:52 +0200 |
---|---|---|
committer | Jakob Sack <kde@jakobsack.de> | 2011-04-18 11:48:52 +0200 |
commit | f22c05deab263129c7d278d5e4d097cd9ec5573a (patch) | |
tree | 91c3de77e41cc22ca3359151433530a0998cff45 /lib/user.php | |
parent | b37fb9142f095b893db818437f8b42b58377f444 (diff) | |
download | nextcloud-server-f22c05deab263129c7d278d5e4d097cd9ec5573a.tar.gz nextcloud-server-f22c05deab263129c7d278d5e4d097cd9ec5573a.zip |
Check for existance of group- and usernames, don't mix OC_USER and OC_GROUP!
Diffstat (limited to 'lib/user.php')
-rw-r--r-- | lib/user.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/user.php b/lib/user.php index 82b012f3a5c..51e4ab358e1 100644 --- a/lib/user.php +++ b/lib/user.php @@ -114,6 +114,11 @@ class OC_USER { if( preg_match( '/[^a-zA-Z0-9 _\.@\-]/', $uid )){ return false; } + // No empty username + if( !$uid ){ + return false; + } + $run = true; OC_HOOK::emit( "OC_USER", "pre_createUser", array( "run" => &$run, "uid" => $uid, "password" => $password )); @@ -138,6 +143,12 @@ class OC_USER { OC_HOOK::emit( "OC_USER", "pre_deleteUser", array( "run" => &$run, "uid" => $uid )); if( $run && self::$_backend->deleteUser( $uid )){ + // We have to delete the user from all groups + foreach( OC_GROUP::getUserGroups( $uid ) as $i ){ + OC_GROUP::removeFromGroup( $uid, $i ); + } + + // Emit and exit OC_HOOK::emit( "OC_USER", "post_deleteUser", array( "uid" => $uid )); return true; } |