From e1835e36fa5d3434f9804670fc3cdd16992ec66a Mon Sep 17 00:00:00 2001
From: Jeroen van Meeuwen <kanarip@kanarip.ch>
Date: Mon, 21 Oct 2019 13:18:59 +0200
Subject: [PATCH] Lower-case the effectiverights attribute/entry level keys

---
 lib/Net/LDAP3.php | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php
index 36ec6c4..74224c1 100644
--- a/lib/Net/LDAP3.php
+++ b/lib/Net/LDAP3.php
@@ -734,20 +734,20 @@ class Net_LDAP3
             if (!empty($result)) {
                 $attributes = array(
                     'dn'                   => $entry_dn,
-                    'attributeLevelRights' => array(),
-                    'entryLevelRights'     => array(),
+                    'attributelevelrights' => array(),
+                    'entrylevelrights'     => array(),
                 );
 
-                foreach (array('aclRights', 'attributeLevelRights', 'entryLevelRights') as $attr_name) {
+                foreach (array('aclrights', 'attributelevelrights', 'entrylevelrights') as $attr_name) {
                     if ($attr_value = $result[$attr_name]) {
                         switch ($attr_name) {
-                        case 'aclRights':
+                        case 'aclrights':
                             $this->parse_aclrights($attributes, $attr_value);
                             break;
-                        case 'attributeLevelRights':
+                        case 'attributelevelrights':
                             $attributes[$attr_name] = $this->parse_attribute_level_rights($attr_value);
                             break;
-                        case 'entryLevelRights':
+                        case 'entrylevelrights':
                             $attributes[$attr_name] = $this->parse_entry_level_rights($attr_value);
                             break;
                         }
@@ -851,8 +851,8 @@ class Net_LDAP3
 
         $attributes = array(
             'dn'                   => $subject_dn,
-            'attributeLevelRights' => array(),
-            'entryLevelRights'     => array(),
+            'attributelevelrights' => array(),
+            'entrylevelrights'     => array(),
         );
 
         if ($this->vendor_name() == "Oracle Corporation") {
@@ -876,10 +876,10 @@ class Net_LDAP3
 
                 switch ($attribute_name) {
                 case "attributeLevelRights":
-                    $attributes[$attribute_name] = $this->parse_attribute_level_rights($attribute_value);
+                    $attributes['attributelevelrights'] = $this->parse_attribute_level_rights($attribute_value);
                     break;
                 case "entryLevelRights":
-                    $attributes[$attribute_name] = $this->parse_entry_level_rights($attribute_value);
+                    $attributes['entrylevelrights'] = $this->parse_entry_level_rights($attribute_value);
                     break;
                 }
             }
@@ -2471,26 +2471,26 @@ class Net_LDAP3
 
         switch ($_acl_components[1]) {
             case "entryLevel":
-                $attributes['entryLevelRights'] = Array();
+                $attributes['entrylevelrights'] = Array();
                 $_acl_value = explode(',', $_acl_value);
 
                 foreach ($_acl_value as $right) {
                     list($method, $bool) = explode(':', $right);
-                    if ($bool == "1" && !in_array($method, $attributes['entryLevelRights'])) {
-                        $attributes['entryLevelRights'][] = $method;
+                    if ($bool == "1" && !in_array($method, $attributes['entrylevelrights'])) {
+                        $attributes['entrylevelrights'][] = $method;
                     }
                 }
 
                 break;
 
             case "attributeLevel":
-                $attributes['attributeLevelRights'][$_acl_components[2]] = Array();
+                $attributes['attributelevelrights'][$_acl_components[2]] = Array();
                 $_acl_value = explode(',', $_acl_value);
 
                 foreach ($_acl_value as $right) {
                     list($method, $bool) = explode(':', $right);
-                    if ($bool == "1" && !in_array($method, $attributes['attributeLevelRights'][$_acl_components[2]])) {
-                        $attributes['attributeLevelRights'][$_acl_components[2]][] = $method;
+                    if ($bool == "1" && !in_array($method, $attributes['attributelevelrights'][$_acl_components[2]])) {
+                        $attributes['attributelevelrights'][$_acl_components[2]][] = $method;
                     }
                 }
 
@@ -3120,7 +3120,7 @@ class Net_LDAP3
         $ckey  = 'domain::' . $domain;
         $ickey = $ckey . '::' . md5(implode(',', $attributes));
 
-        if (array_key_exists($ckey, $this->icache)) {
+        if (array_key_exists($ickey, $this->icache)) {
             return $this->icache[$ickey];
         }
 
-- 
GitLab