[Kimchi-devel] [PATCH] issue#532: Fix ldap admin filtering

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Fri Dec 5 08:44:49 UTC 2014


From: Royce Lv <lvroyce at linux.vnet.ibm.com>

LDAP admin ID is filtered because leading/trailing spaces.
Fix this by truncating spaces.

Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
 src/kimchi/auth.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/kimchi/auth.py b/src/kimchi/auth.py
index 330d98c..22c5c81 100644
--- a/src/kimchi/auth.py
+++ b/src/kimchi/auth.py
@@ -222,9 +222,11 @@ class LDAPUser(User):
         return self.user[USER_GROUPS]
 
     def get_roles(self):
-        admin_id = config.get("authentication", "ldap_admin_id").strip('"')
-        if self.user[USER_NAME] in admin_id.split(','):
-            self.user[USER_ROLES] = dict.fromkeys(tabs, 'admin')
+        admin_ids = config.get(
+            "authentication", "ldap_admin_id").strip('"').split(',')
+        for admin_id in admin_ids:
+            if self.user[USER_NAME] == admin_id.strip():
+                self.user[USER_ROLES] = dict.fromkeys(tabs, 'admin')
         return self.user[USER_ROLES]
 
     def get_user(self):
-- 
1.8.3.2




More information about the Kimchi-devel mailing list