[Pkg-owncloud-commits] [owncloud] 19/23: Correctly use groups parameter only when its not empty

David Prévot taffit at moszumanska.debian.org
Tue Jul 22 15:21:36 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit e482ba60bcbbc2c5b8b143946bfe6ac14e7fdf7f
Author: Joas Schilling <nickvergessen at gmx.de>
Date:   Mon Jul 21 10:43:29 2014 +0200

    Correctly use groups parameter only when its not empty
    
    Fix #9745
    
    Backport of c84c1f5 from master
---
 settings/ajax/createuser.php | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/settings/ajax/createuser.php b/settings/ajax/createuser.php
index ae1d885..463c15d 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());
 	}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list