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

Aline Manera alinefm at linux.vnet.ibm.com
Fri Dec 5 13:21:03 UTC 2014


Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>

On 12/05/2014 06:44 AM, lvroyce at linux.vnet.ibm.com wrote:
> 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):




More information about the Kimchi-devel mailing list