summaryrefslogtreecommitdiffstats
path: root/lib/group.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/group.php')
-rw-r--r--lib/group.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/group.php b/lib/group.php
index 1161b9035fa..54dc0b6463c 100644
--- a/lib/group.php
+++ b/lib/group.php
@@ -171,11 +171,11 @@ class OC_Group {
*/
public static function addToGroup( $uid, $gid ){
// Does the user exist?
- if( !in_array( $uid, OC_User::getUsers())){
+ if( !OC_User::userExists($uid)){
return false;
}
// Does the group exist?
- if( !in_array( $gid, self::getGroups())){
+ if( !OC_Group::groupExists($gid)){
return false;
}
@@ -234,4 +234,13 @@ class OC_Group {
public static function getGroups(){
return self::$_backend->getGroups();
}
+
+ /**
+ * check if a group exists
+ * @param string $gid
+ * @return bool
+ */
+ public static function groupExists($gid){
+ return in_array( $gid, self::getGroups());
+ }
}