diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-07-21 10:43:29 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-07-21 10:46:21 +0200 |
commit | c84c1f519f96ab995e8d3c2f65951e32d8d01547 (patch) | |
tree | bed4588f561cf5469a71f07e73e029608719749b /settings/ajax | |
parent | ddd8eae9320bcd5317f18a6305120c358f72bcdd (diff) | |
download | nextcloud-server-c84c1f519f96ab995e8d3c2f65951e32d8d01547.tar.gz nextcloud-server-c84c1f519f96ab995e8d3c2f65951e32d8d01547.zip |
Correctly use groups parameter only when its not empty
Fix #9745
Diffstat (limited to 'settings/ajax')
-rw-r--r-- | settings/ajax/createuser.php | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/settings/ajax/createuser.php b/settings/ajax/createuser.php index ae1d8856f43..463c15d59e8 100644 --- a/settings/ajax/createuser.php +++ b/settings/ajax/createuser.php @@ -5,21 +5,23 @@ OC_JSON::checkSubAdminUser(); if(OC_User::isAdminUser(OC_User::getUser())) { $groups = array(); - if( isset( $_POST["groups"] )) { + if (!empty($_POST["groups"])) { $groups = $_POST["groups"]; } }else{ - if(isset( $_POST["groups"] )) { + if (isset($_POST["groups"])) { $groups = array(); - foreach($_POST["groups"] as $group) { - if(OC_SubAdmin::isGroupAccessible(OC_User::getUser(), $group)) { - $groups[] = $group; + if (!empty($_POST["groups"])) { + foreach ($_POST["groups"] as $group) { + if (OC_SubAdmin::isGroupAccessible(OC_User::getUser(), $group)) { + $groups[] = $group; + } } } - if(count($groups) === 0) { + if (empty($groups)) { $groups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()); } - }else{ + } else { $groups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()); } } |