summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <leo@strike.wu.ac.at>2013-12-11 10:43:48 +0100
committerroot <leo@strike.wu.ac.at>2013-12-11 10:43:48 +0100
commit2b127a6ac5c4da7a34c49f87878b643dafc5e40d (patch)
treecbffe7014d1ba8315348ed299963d23e0140ff79
parenta18cff44795c5888c993f83b89b8bd7f0d0b4af6 (diff)
downloadnextcloud-server-2b127a6ac5c4da7a34c49f87878b643dafc5e40d.tar.gz
nextcloud-server-2b127a6ac5c4da7a34c49f87878b643dafc5e40d.zip
fix indentation
use identity test where appropriate use camelcase variable names _getGroupsByMember is a private function
-rw-r--r--apps/user_ldap/group_ldap.php84
1 files changed, 42 insertions, 42 deletions
diff --git a/apps/user_ldap/group_ldap.php b/apps/user_ldap/group_ldap.php
index 1300a280b00..fb47de7d945 100644
--- a/apps/user_ldap/group_ldap.php
+++ b/apps/user_ldap/group_ldap.php
@@ -88,37 +88,37 @@ class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface {
return $isInGroup;
}
- private function _groupMembers($dn_group, &$groups_seen = null) {
- if ($groups_seen == null) {
- $groups_seen = array();
+ private function _groupMembers($dnGroup, &$seen = null) {
+ if ($seen === null) {
+ $seen = array();
}
- $all_members = array();
- if (array_key_exists($dn_group, $groups_seen)) {
+ $allMembers = array();
+ if (array_key_exists($dnGroup, $seen)) {
// avoid loops
return array();
}
// used extensively in cron job, caching makes sense for nested groups
- $cache_key = '_groupMembers'.$dn_group;
- if($this->access->connection->isCached($cache_key)) {
- return $this->access->connection->getFromCache($cache_key);
+ $cacheKey = '_groupMembers'.$dnGroup;
+ if($this->access->connection->isCached($cacheKey)) {
+ return $this->access->connection->getFromCache($cacheKey);
}
- $groups_seen[$dn_group] = 1;
- $members = $this->access->readAttribute($dn_group, $this->access->connection->ldapGroupMemberAssocAttr,
- $this->access->connection->ldapGroupFilter);
+ $seen[$dnGroup] = 1;
+ $members = $this->access->readAttribute($dnGroup, $this->access->connection->ldapGroupMemberAssocAttr,
+ $this->access->connection->ldapGroupFilter);
if ($members) {
- foreach ($members as $member_dn) {
- $all_members[$member_dn] = 1;
- if ($this->access->connection->ldapNestedGroups) {
- $submembers = $this->_groupMembers($member_dn, $groups_seen);
- if ($submembers) {
- $all_members = array_merge($all_members, $submembers);
- }
- }
- }
- }
- $this->access->connection->writeToCache($cache_key, $all_members);
- return $all_members;
- }
+ foreach ($members as $memberDN) {
+ $allMembers[$memberDN] = 1;
+ if ($this->access->connection->ldapNestedGroups) {
+ $subMembers = $this->_groupMembers($memberDN, $seen);
+ if ($subMembers) {
+ $allMembers = array_merge($allMembers, $subMembers);
+ }
+ }
+ }
+ }
+ $this->access->connection->writeToCache($cacheKey, $allMembers);
+ return $allMembers;
+ }
/**
* @brief Get all groups a user belongs to
@@ -162,11 +162,11 @@ class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface {
return $groups;
}
- /* private */ public function _getGroupsByMember($dn, &$seen = null) {
- if ($seen == null) {
- $seen = array();
+ private function _getGroupsByMember($dn, &$seen = null) {
+ if ($seen === null) {
+ $seen = array();
}
- $all_groups = array();
+ $allGroups = array();
if (array_key_exists($dn, $seen)) {
// avoid loops
return array();
@@ -177,20 +177,20 @@ class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface {
$this->access->connection->ldapGroupMemberAssocAttr.'='.$dn
));
$groups = $this->access->fetchListOfGroups($filter,
- array($this->access->connection->ldapGroupDisplayName, 'dn'));
- if ($groups) {
- foreach ($groups as $groupobj) {
- $group_dn = $groupobj['dn'];
- $all_groups[$group_dn] = $groupobj;
- if ($this->access->connection->ldapNestedGroups) {
- $supergroups = $this->_getGroupsByMember($group_dn, $seen);
- if ($supergroups) {
- $all_groups = array_merge($all_groups, $supergroups);
- }
- }
- }
- }
- return $all_groups;
+ array($this->access->connection->ldapGroupDisplayName, 'dn'));
+ if ($groups) {
+ foreach ($groups as $groupobj) {
+ $groupDN = $groupobj['dn'];
+ $allGroups[$groupDN] = $groupobj;
+ if ($this->access->connection->ldapNestedGroups) {
+ $supergroups = $this->_getGroupsByMember($groupDN, $seen);
+ if ($supergroups) {
+ $allGroups = array_merge($allGroups, $supergroups);
+ }
+ }
+ }
+ }
+ return $allGroups;
}
/**