From c84c1f519f96ab995e8d3c2f65951e32d8d01547 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 21 Jul 2014 10:43:29 +0200 Subject: Correctly use groups parameter only when its not empty Fix #9745 --- settings/ajax/createuser.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'settings/ajax') 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()); } } -- cgit v1.2.3