lib/Auth lib/ext
Aleksander Machniak
machniak at kolabsys.com
Sat Oct 20 12:57:50 CEST 2012
lib/Auth/LDAP.php | 6 +++---
lib/ext/Net/LDAP3.php | 13 +++++++++++--
2 files changed, 14 insertions(+), 5 deletions(-)
New commits:
commit 5db0dfe50c1b2a0407e9bf465af6a8bda44ef686
Author: Aleksander Machniak <alec at alec.pl>
Date: Sat Oct 20 12:56:45 2012 +0200
Fix role deletion (#696)
diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index 4bfe7c5..f4fd89c 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -694,7 +694,7 @@ class LDAP extends Net_LDAP3 {
}
public function role_delete($role) {
- return $this->entry_delete($role);
+ return $this->entry_delete($role, array('objectclass' => 'ldapsubentry'));
}
public function role_find_by_attribute($attribute) {
@@ -821,10 +821,10 @@ class LDAP extends Net_LDAP3 {
/**
* delete_entry() wrapper with binding and DN resolving
*/
- protected function entry_delete($entry) {
+ protected function entry_delete($entry, $attributes = array()) {
$this->bind($_SESSION['user']->user_bind_dn, $_SESSION['user']->user_bind_pw);
- $entry_dn = $this->entry_dn($entry);
+ $entry_dn = $this->entry_dn($entry, $attributes);
if (!$entry_dn) {
return false;
diff --git a/lib/ext/Net/LDAP3.php b/lib/ext/Net/LDAP3.php
index 75c01a5..432d68d 100644
--- a/lib/ext/Net/LDAP3.php
+++ b/lib/ext/Net/LDAP3.php
@@ -627,7 +627,15 @@ class Net_LDAP3
return $attributes;
}
- public function entry_dn($subject)
+ /**
+ * Resolve entry data to entry DN
+ *
+ * @param string $subject Entry string (e.g. entry DN or unique attribute value)
+ * @param array $attributes Additional attributes
+ *
+ * @return string Entry DN string
+ */
+ public function entry_dn($subject, $attributes = array())
{
$this->_debug("entry_dn on subject $subject");
$is_dn = ldap_explode_dn($subject, 1);
@@ -638,7 +646,8 @@ class Net_LDAP3
}
$unique_attr = $this->config_get('unique_attribute', 'nsuniqueid');
- $subject = $this->entry_find_by_attribute(array($unique_attr => $subject));
+ $attributes = array_merge(array($unique_attr => $subject), (array)$attributes);
+ $subject = $this->entry_find_by_attribute($attributes);
if (!empty($subject)) {
return key($subject);
More information about the commits
mailing list