]> source.dussan.org Git - nextcloud-server.git/commitdiff
LDAP: coding style
authorArthur Schiwon <blizzz@owncloud.com>
Wed, 11 Sep 2013 17:42:08 +0000 (19:42 +0200)
committerArthur Schiwon <blizzz@owncloud.com>
Fri, 27 Sep 2013 11:34:15 +0000 (13:34 +0200)
apps/user_ldap/group_ldap.php
apps/user_ldap/group_proxy.php
apps/user_ldap/lib/access.php
apps/user_ldap/lib/backendutility.php
apps/user_ldap/lib/connection.php
apps/user_ldap/lib/ildapwrapper.php
apps/user_ldap/lib/ldaputility.php
apps/user_ldap/user_ldap.php
apps/user_ldap/user_proxy.php

index 80b988594dea31bd2afd7be0668c1d616bbe16ee..32e2cec5960ade394ef892a661e2a9b6d1f8c4eb 100644 (file)
@@ -61,7 +61,8 @@ class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface {
                        return false;
                }
                //usually, LDAP attributes are said to be case insensitive. But there are exceptions of course.
-               $members = $this->access->readAttribute($dn_group, $this->access->connection->ldapGroupMemberAssocAttr);
+               $members = $this->access->readAttribute($dn_group,
+                                               $this->access->connection->ldapGroupMemberAssocAttr);
                if(!$members) {
                        $this->access->connection->writeToCache('inGroup'.$uid.':'.$gid, false);
                        return false;
@@ -127,7 +128,8 @@ class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface {
                        $this->access->connection->ldapGroupFilter,
                        $this->access->connection->ldapGroupMemberAssocAttr.'='.$uid
                ));
-               $groups = $this->access->fetchListOfGroups($filter, array($this->access->connection->ldapGroupDisplayName, 'dn'));
+               $groups = $this->access->fetchListOfGroups($filter,
+                               array($this->access->connection->ldapGroupDisplayName, 'dn'));
                $groups = array_unique($this->access->ownCloudGroupNames($groups), SORT_LOCALE_STRING);
                $this->access->connection->writeToCache($cacheKey, $groups);
 
@@ -170,7 +172,8 @@ class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface {
                        return array();
                }
 
-               $members = $this->access->readAttribute($groupDN, $this->access->connection->ldapGroupMemberAssocAttr);
+               $members = $this->access->readAttribute($groupDN,
+                                               $this->access->connection->ldapGroupMemberAssocAttr);
                if(!$members) {
                        //in case users could not be retrieved, return empty resultset
                        $this->access->connection->writeToCache($cachekey, array());
@@ -263,8 +266,10 @@ class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface {
                        $this->access->getFilterPartForGroupSearch($search)
                ));
                \OCP\Util::writeLog('user_ldap', 'getGroups Filter '.$filter, \OCP\Util::DEBUG);
-               $ldap_groups = $this->access->fetchListOfGroups($filter, array($this->access->connection->ldapGroupDisplayName, 'dn'),
-                       $limit, $offset);
+               $ldap_groups = $this->access->fetchListOfGroups($filter,
+                               array($this->access->connection->ldapGroupDisplayName, 'dn'),
+                               $limit,
+                               $offset);
                $ldap_groups = $this->access->ownCloudGroupNames($ldap_groups);
 
                $this->access->connection->writeToCache($cachekey, $ldap_groups);
@@ -285,7 +290,8 @@ class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface {
                        return $this->access->connection->getFromCache('groupExists'.$gid);
                }
 
-               //getting dn, if false the group does not exist. If dn, it may be mapped only, requires more checking.
+               //getting dn, if false the group does not exist. If dn, it may be mapped
+               //only, requires more checking.
                $dn = $this->access->groupname2dn($gid);
                if(!$dn) {
                        $this->access->connection->writeToCache('groupExists'.$gid, false);
index 78a616854c718b1b0020cd4bf7f83abb1d2598b8..acc563c9532e14ebde97a792686e2b9dce76e178 100644 (file)
@@ -36,7 +36,8 @@ class Group_Proxy extends lib\Proxy implements \OCP\GroupInterface {
        public function __construct($serverConfigPrefixes, ILDAPWrapper $ldap) {
                parent::__construct($ldap);
                foreach($serverConfigPrefixes as $configPrefix) {
-                   $this->backends[$configPrefix] = new \OCA\user_ldap\GROUP_LDAP($this->getAccess($configPrefix));
+                   $this->backends[$configPrefix] =
+                               new \OCA\user_ldap\GROUP_LDAP($this->getAccess($configPrefix));
                        if(is_null($this->refBackend)) {
                                $this->refBackend = &$this->backends[$configPrefix];
                        }
index 3d791755aba866a3d2328357b7f4a6a48397b030..fdf9c24612d13e11907d4a29d93477521b007c44 100644 (file)
@@ -80,7 +80,8 @@ class Access extends LDAPUtility {
                        return false;
                }
                //LDAP attributes are not case sensitive
-               $result = \OCP\Util::mb_array_change_key_case($this->ldap->getAttributes($cr, $er), MB_CASE_LOWER, 'UTF-8');
+               $result = \OCP\Util::mb_array_change_key_case(
+                               $this->ldap->getAttributes($cr, $er), MB_CASE_LOWER, 'UTF-8');
                $attr = mb_strtolower($attr, 'UTF-8');
 
                if(isset($result[$attr]) && $result[$attr]['count'] > 0) {
@@ -669,7 +670,8 @@ class Access extends LDAPUtility {
                $error = $this->ldap->errno($link_resource);
                if(!is_array($sr) || $error !== 0) {
                        \OCP\Util::writeLog('user_ldap',
-                               'Error when searching: '.$this->ldap->error($link_resource).' code '.$this->ldap->errno($link_resource),
+                               'Error when searching: '.$this->ldap->error($link_resource).
+                                       ' code '.$this->ldap->errno($link_resource),
                                \OCP\Util::ERROR);
                        \OCP\Util::writeLog('user_ldap', 'Attempt for Paging?  '.print_r($pagedSearchOK, true), \OCP\Util::ERROR);
                        return array();
index f279b1e997ecb5205e0feccb907df3cabd8f193b..815757a1a11682bb360bbb923348fe7331662d45 100644 (file)
@@ -35,4 +35,4 @@ abstract class BackendUtility {
        public function __construct(Access $access) {
                $this->access = $access;
        }
-}
\ No newline at end of file
+}
index 053ec7e2355964ce54986ff0cab0ec5ee0a0c25b..a53022c27b3231b23c5aee02a92288402e490c56 100644 (file)
@@ -396,7 +396,8 @@ class Connection extends LDAPUtility {
        public function saveConfiguration() {
                $trans = array_flip($this->getConfigTranslationArray());
                foreach($this->config as $key => $value) {
-                       \OCP\Util::writeLog('user_ldap', 'LDAP: storing key '.$key.' value '.print_r($value, true), \OCP\Util::DEBUG);
+                       \OCP\Util::writeLog('user_ldap', 'LDAP: storing key '.$key.
+                               ' value '.print_r($value, true), \OCP\Util::DEBUG);
                        switch ($key) {
                                case 'ldapAgentPassword':
                                        $value = base64_encode($value);
@@ -634,7 +635,8 @@ class Connection extends LDAPUtility {
                        if(!$this->config['ldapOverrideMainServer'] && !$this->getFromCache('overrideMainServer')) {
                                $this->doConnect($this->config['ldapHost'], $this->config['ldapPort']);
                                $bindStatus = $this->bind();
-                               $error = $this->ldap->isResource($this->ldapConnectionRes) ? $this->ldap->errno($this->ldapConnectionRes) : -1;
+                               $error = $this->ldap->isResource($this->ldapConnectionRes) ?
+                                                       $this->ldap->errno($this->ldapConnectionRes) : -1;
                        } else {
                                $bindStatus = false;
                                $error = null;
@@ -692,7 +694,9 @@ class Connection extends LDAPUtility {
                if(!$this->ldap->isResource($cr)) {
                        return false;
                }
-               $ldapLogin = @$this->ldap->bind($cr, $this->config['ldapAgentName'], $this->config['ldapAgentPassword']);
+               $ldapLogin = @$this->ldap->bind($cr,
+                                                                               $this->config['ldapAgentName'],
+                                                                               $this->config['ldapAgentPassword']);
                if(!$ldapLogin) {
                        \OCP\Util::writeLog('user_ldap',
                                'Bind failed: ' . $this->ldap->errno($cr) . ': ' . $this->ldap->error($cr),
index be35cebe9456a0e3101097c9801cb43e3890d098..9e6bd56ef2a0920087e259030b02ce756bafdc4f 100644 (file)
@@ -177,4 +177,4 @@ interface ILDAPWrapper {
         */
        public function isResource($resource);
 
-}
\ No newline at end of file
+}
index 975df7d1de06d898550dc9f8b6b816484a62dac2..7fffd9c88d18c1efe5cdd97624738594b830bceb 100644 (file)
@@ -33,4 +33,4 @@ abstract class LDAPUtility {
        public function __construct(ILDAPWrapper $ldapWrapper) {
                $this->ldap = $ldapWrapper;
        }
-}
\ No newline at end of file
+}
index f2e99d4579477aaaab009cf348ce606d0caa6a63..6f52bbdf233b3c85b5ad0b9617073640f7cba9d5 100644 (file)
@@ -79,7 +79,8 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface {
         */
        public function checkPassword($uid, $password) {
                //find out dn of the user name
-               $filter = \OCP\Util::mb_str_replace('%uid', $uid, $this->access->connection->ldapLoginFilter, 'UTF-8');
+               $filter = \OCP\Util::mb_str_replace(
+                       '%uid', $uid, $this->access->connection->ldapLoginFilter, 'UTF-8');
                $ldap_users = $this->access->fetchListOfUsers($filter, 'dn');
                if(count($ldap_users) < 1) {
                        return false;
@@ -158,7 +159,8 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface {
                //getting dn, if false the user does not exist. If dn, he may be mapped only, requires more checking.
                $dn = $this->access->username2dn($uid);
                if(!$dn) {
-                       \OCP\Util::writeLog('user_ldap', 'No DN found for '.$uid.' on '.$this->access->connection->ldapHost, \OCP\Util::DEBUG);
+                       \OCP\Util::writeLog('user_ldap', 'No DN found for '.$uid.' on '.
+                               $this->access->connection->ldapHost, \OCP\Util::DEBUG);
                        $this->access->connection->writeToCache('userExists'.$uid, false);
                        return false;
                }
index c7b469c8224061f4ae0d884860a9736a21dc116e..092fdbf7c782c55d8b2f1d4417e8ef7f397abc8e 100644 (file)
@@ -36,7 +36,8 @@ class User_Proxy extends lib\Proxy implements \OCP\UserInterface {
        public function __construct($serverConfigPrefixes, ILDAPWrapper $ldap) {
                parent::__construct($ldap);
                foreach($serverConfigPrefixes as $configPrefix) {
-                   $this->backends[$configPrefix] = new \OCA\user_ldap\USER_LDAP($this->getAccess($configPrefix));
+                   $this->backends[$configPrefix] =
+                               new \OCA\user_ldap\USER_LDAP($this->getAccess($configPrefix));
                        if(is_null($this->refBackend)) {
                                $this->refBackend = &$this->backends[$configPrefix];
                        }