summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-07-07 19:29:43 +0200
committerGitHub <noreply@github.com>2016-07-07 19:29:43 +0200
commit2a1a3957b65e847d51c4c735acf033f7df29cba6 (patch)
treee53ac77b3dfa0d425b9ea8084420988a4d7054b7 /apps/user_ldap
parentf5ed01617045a816977688a6c9e549fdf2dab509 (diff)
parentbeae00a5e5457c41994e54c7f0563245d9ccf5ce (diff)
downloadnextcloud-server-2a1a3957b65e847d51c4c735acf033f7df29cba6.tar.gz
nextcloud-server-2a1a3957b65e847d51c4c735acf033f7df29cba6.zip
Merge pull request #333 from nextcloud/sync-master
Sync master
Diffstat (limited to 'apps/user_ldap')
-rw-r--r--apps/user_ldap/lib/User/Manager.php28
-rw-r--r--apps/user_ldap/lib/User_LDAP.php4
-rw-r--r--apps/user_ldap/templates/part.settingcontrols.php2
-rw-r--r--apps/user_ldap/templates/part.wizardcontrols.php2
4 files changed, 21 insertions, 15 deletions
diff --git a/apps/user_ldap/lib/User/Manager.php b/apps/user_ldap/lib/User/Manager.php
index 55d7ac8a81c..767a2351aeb 100644
--- a/apps/user_ldap/lib/User/Manager.php
+++ b/apps/user_ldap/lib/User/Manager.php
@@ -25,6 +25,7 @@
namespace OCA\User_LDAP\User;
+use OC\Cache\CappedMemoryCache;
use OCA\User_LDAP\LogWrapper;
use OCA\User_LDAP\FilesystemHelper;
use OCP\IAvatarManager;
@@ -62,14 +63,13 @@ class Manager {
protected $avatarManager;
/**
- * array['byDN'] \OCA\User_LDAP\User\User[]
- * ['byUid'] \OCA\User_LDAP\User\User[]
- * @var array $users
+ * @var CappedMemoryCache $usersByDN
*/
- protected $users = array(
- 'byDN' => array(),
- 'byUid' => array(),
- );
+ protected $usersByDN;
+ /**
+ * @var CappedMemoryCache $usersByUid
+ */
+ protected $usersByUid;
/**
* @param IConfig $ocConfig
@@ -93,6 +93,8 @@ class Manager {
$this->image = $image;
$this->db = $db;
$this->userManager = $userManager;
+ $this->usersByDN = new CappedMemoryCache();
+ $this->usersByUid = new CappedMemoryCache();
}
/**
@@ -116,8 +118,8 @@ class Manager {
$user = new User($uid, $dn, $this->access, $this->ocConfig,
$this->ocFilesystem, clone $this->image, $this->ocLog,
$this->avatarManager, $this->userManager);
- $this->users['byDN'][$dn] = $user;
- $this->users['byUid'][$uid] = $user;
+ $this->usersByDN[$dn] = $user;
+ $this->usersByUid[$uid] = $user;
return $user;
}
@@ -219,10 +221,10 @@ class Manager {
*/
public function get($id) {
$this->checkAccess();
- if(isset($this->users['byDN'][$id])) {
- return $this->users['byDN'][$id];
- } else if(isset($this->users['byUid'][$id])) {
- return $this->users['byUid'][$id];
+ if(isset($this->usersByDN[$id])) {
+ return $this->usersByDN[$id];
+ } else if(isset($this->usersByUid[$id])) {
+ return $this->usersByUid[$id];
}
if($this->access->stringResemblesDN($id) ) {
diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php
index 230c82a3045..7929394893b 100644
--- a/apps/user_ldap/lib/User_LDAP.php
+++ b/apps/user_ldap/lib/User_LDAP.php
@@ -228,6 +228,10 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
return false;
}
$newDn = $this->access->getUserDnByUuid($uuid);
+ //check if renamed user is still valid by reapplying the ldap filter
+ if(!is_array($this->access->readAttribute($newDn, '', $this->access->connection->ldapUserFilter))) {
+ return false;
+ }
$this->access->getUserMapper()->setDNbyUUID($newDn, $uuid);
return true;
} catch (\Exception $e) {
diff --git a/apps/user_ldap/templates/part.settingcontrols.php b/apps/user_ldap/templates/part.settingcontrols.php
index 4dc57eae6d2..3f7a53dd4dc 100644
--- a/apps/user_ldap/templates/part.settingcontrols.php
+++ b/apps/user_ldap/templates/part.settingcontrols.php
@@ -4,7 +4,7 @@
</button>
<a href="<?php p(link_to_docs('admin-ldap')); ?>"
target="_blank" rel="noreferrer">
- <img src="<?php print_unescaped(image_path('', 'actions/info.png')); ?>"
+ <img src="<?php print_unescaped(image_path('', 'actions/info.svg')); ?>"
style="height:1.75ex" />
<?php p($l->t('Help'));?>
</a>
diff --git a/apps/user_ldap/templates/part.wizardcontrols.php b/apps/user_ldap/templates/part.wizardcontrols.php
index 4760aa0d8ef..2df1fd8d83f 100644
--- a/apps/user_ldap/templates/part.wizardcontrols.php
+++ b/apps/user_ldap/templates/part.wizardcontrols.php
@@ -10,7 +10,7 @@
</button>
<a href="<?php p(link_to_docs('admin-ldap')); ?>"
target="_blank" rel="noreferrer">
- <img src="<?php print_unescaped(image_path('', 'actions/info.png')); ?>"
+ <img src="<?php print_unescaped(image_path('', 'actions/info.svg')); ?>"
style="height:1.75ex" />
<span class="ldap_grey"><?php p($l->t('Help'));?></span>
</a>