diff options
author | Jakob Sack <kde@jakobsack.de> | 2011-04-18 12:39:28 +0200 |
---|---|---|
committer | Jakob Sack <kde@jakobsack.de> | 2011-04-18 12:39:28 +0200 |
commit | da30671ec474bfa522d0a0b21d3e457437b9b57b (patch) | |
tree | 1776076ec122cb1c60d089d15abf6a674f474012 /lib/group.php | |
parent | fe90bf4bdce4eb03722382ecbd054035d6b3c590 (diff) | |
download | nextcloud-server-da30671ec474bfa522d0a0b21d3e457437b9b57b.tar.gz nextcloud-server-da30671ec474bfa522d0a0b21d3e457437b9b57b.zip |
More error checking in user management
Diffstat (limited to 'lib/group.php')
-rw-r--r-- | lib/group.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/group.php b/lib/group.php index 074e464f581..6510838ccfc 100644 --- a/lib/group.php +++ b/lib/group.php @@ -108,6 +108,10 @@ class OC_GROUP { if( !$gid ){ return false; } + // No duplicate group names + if( in_array( $gid, self::getGroups())){ + return false; + } $run = true; OC_HOOK::emit( "OC_GROUP", "pre_createGroup", array( "run" => &$run, "gid" => $gid )); @@ -167,6 +171,16 @@ class OC_GROUP { * Adds a user to a group. */ public static function addToGroup( $uid, $gid ){ + // Does the user exist? + if( !in_array( $uid, OC_USER::getUsers())){ + return false; + } + // Does the group exist? + if( !in_array( $gid, self::getGroups())){ + return false; + } + + // Go go go $run = true; OC_HOOK::emit( "OC_GROUP", "pre_addToGroup", array( "run" => &$run, "uid" => $uid, "gid" => $gid )); |