aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/access.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/lib/access.php')
-rw-r--r--apps/user_ldap/lib/access.php32
1 files changed, 16 insertions, 16 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 042076fe62e..f888577aedb 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -133,7 +133,7 @@ abstract class Access {
'\"' => '\5c22',
'\#' => '\5c23',
);
- $dn = str_replace(array_keys($replacements),array_values($replacements), $dn);
+ $dn = str_replace(array_keys($replacements), array_values($replacements), $dn);
return $dn;
}
@@ -288,8 +288,8 @@ abstract class Access {
}
$ldapname = $this->sanitizeUsername($ldapname);
- //a new user/group! Then let's try to add it. We're shooting into the blue with the user/group name, assuming that in most cases there will not be a conflict. Otherwise an error will occur and we will continue with our second shot.
- if(($isUser && !\OCP\User::userExists($ldapname)) || (!$isUser && !\OC_Group::groupExists($ldapname))) {
+ //a new user/group! Add it only if it doesn't conflict with other backend's users or existing groups
+ if(($isUser && !\OCP\User::userExists($ldapname, 'OCA\\user_ldap\\USER_LDAP')) || (!$isUser && !\OC_Group::groupExists($ldapname))) {
if($this->mapComponent($dn, $ldapname, $isUser)) {
return $ldapname;
}
@@ -347,20 +347,20 @@ abstract class Access {
}
private function findMappedGroup($dn) {
- static $query = null;
+ static $query = null;
if(is_null($query)) {
$query = \OCP\DB::prepare('
- SELECT `owncloud_name`
- FROM `'.$this->getMapTable(false).'`
- WHERE `ldap_dn` = ?'
- );
- }
- $res = $query->execute(array($dn))->fetchOne();
- if($res) {
- return $res;
- }
+ SELECT `owncloud_name`
+ FROM `'.$this->getMapTable(false).'`
+ WHERE `ldap_dn` = ?'
+ );
+ }
+ $res = $query->execute(array($dn))->fetchOne();
+ if($res) {
+ return $res;
+ }
return false;
- }
+ }
private function ldap2ownCloudNames($ldapObjects, $isUsers) {
@@ -619,7 +619,7 @@ abstract class Access {
//a) paged search insuccessful, though attempted
//b) no paged search, but limit set
if((!$this->pagedSearchedSuccessful
- && $pagedSearchOK)
+ && $pagedSearchOK)
|| (
!$pagedSearchOK
&& !is_null($limit)
@@ -881,4 +881,4 @@ abstract class Access {
return $pagedSearchOK;
}
-} \ No newline at end of file
+}