diff options
author | root <leo@strike.wu.ac.at> | 2014-02-12 16:56:17 +0100 |
---|---|---|
committer | root <leo@strike.wu.ac.at> | 2014-02-12 16:56:17 +0100 |
commit | d10f6e94dcc92a2242aae2b2331b6f85da8d8b6c (patch) | |
tree | 5c279e8c8a5766b512f7b0b6fd84aa5c15edfe18 /apps/user_ldap/group_ldap.php | |
parent | 2b127a6ac5c4da7a34c49f87878b643dafc5e40d (diff) | |
download | nextcloud-server-d10f6e94dcc92a2242aae2b2331b6f85da8d8b6c.tar.gz nextcloud-server-d10f6e94dcc92a2242aae2b2331b6f85da8d8b6c.zip |
fix coding style to blizzz happy.. ;-)
Diffstat (limited to 'apps/user_ldap/group_ldap.php')
-rw-r--r-- | apps/user_ldap/group_ldap.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/user_ldap/group_ldap.php b/apps/user_ldap/group_ldap.php index fb47de7d945..509f65712fd 100644 --- a/apps/user_ldap/group_ldap.php +++ b/apps/user_ldap/group_ldap.php @@ -105,10 +105,11 @@ class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface { $seen[$dnGroup] = 1; $members = $this->access->readAttribute($dnGroup, $this->access->connection->ldapGroupMemberAssocAttr, $this->access->connection->ldapGroupFilter); - if ($members) { + if (is_array($members)) { foreach ($members as $memberDN) { $allMembers[$memberDN] = 1; - if ($this->access->connection->ldapNestedGroups) { + $nestedGroups = $this->access->connection->ldapNestedGroups; + if (!empty($nestedGroups)) { $subMembers = $this->_groupMembers($memberDN, $seen); if ($subMembers) { $allMembers = array_merge($allMembers, $subMembers); @@ -155,14 +156,14 @@ class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface { $uid = $userDN; } - $groups = array_values($this->_getGroupsByMember($uid)); + $groups = array_values($this->getGroupsByMember($uid)); $groups = array_unique($this->access->ownCloudGroupNames($groups), SORT_LOCALE_STRING); $this->access->connection->writeToCache($cacheKey, $groups); return $groups; } - private function _getGroupsByMember($dn, &$seen = null) { + private function getGroupsByMember($dn, &$seen = null) { if ($seen === null) { $seen = array(); } @@ -178,13 +179,14 @@ class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface { )); $groups = $this->access->fetchListOfGroups($filter, array($this->access->connection->ldapGroupDisplayName, 'dn')); - if ($groups) { + if (is_array($groups)) { foreach ($groups as $groupobj) { $groupDN = $groupobj['dn']; $allGroups[$groupDN] = $groupobj; - if ($this->access->connection->ldapNestedGroups) { - $supergroups = $this->_getGroupsByMember($groupDN, $seen); - if ($supergroups) { + $nestedGroups = $this->access->connection->ldapNestedGroups; + if (!empty($nestedGroups)) { + $supergroups = $this->getGroupsByMember($groupDN, $seen); + if (is_array($supergroups) && (count($supergroups)>0)) { $allGroups = array_merge($allGroups, $supergroups); } } |