From 2c99924f7d2a98c61920de837272d9cff1a33876 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 17 May 2012 00:47:43 +0200 Subject: [PATCH] make sure the group exists in the backend before adding a user to it --- lib/group.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/group.php b/lib/group.php index 9b2959d1f7..1e0216a932 100644 --- a/lib/group.php +++ b/lib/group.php @@ -177,7 +177,11 @@ class OC_Group { if(!$backend->implementsActions(OC_GROUP_BACKEND_ADD_TO_GROUP)) continue; - $succes|=$backend->addToGroup($uid, $gid); + if($backend->groupExists($gid)){ + $succes|=$backend->addToGroup($uid, $gid); + } + } + if($succes){ OC_Hook::emit( "OC_User", "post_addToGroup", array( "uid" => $uid, "gid" => $gid )); } return $succes;