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;
$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);
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());
$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);
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);
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];
}
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) {
$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();
public function __construct(Access $access) {
$this->access = $access;
}
-}
\ No newline at end of file
+}
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);
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;
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),
*/
public function isResource($resource);
-}
\ No newline at end of file
+}
public function __construct(ILDAPWrapper $ldapWrapper) {
$this->ldap = $ldapWrapper;
}
-}
\ No newline at end of file
+}
*/
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;
//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;
}
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];
}