From 5cd320964ca249449fb08a68c4ca18e8bda1e98b Mon Sep 17 00:00:00 2001 From: INOPIAE Date: Tue, 18 Jun 2019 20:22:18 +0200 Subject: [PATCH] upd: fixes problem if no special rights are granted to user --- motion.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/motion.py b/motion.py index 24c86de..51f21de 100644 --- a/motion.py +++ b/motion.py @@ -37,6 +37,7 @@ def lookup_user(): user = env.get("USER") roles = env.get("ROLES") + if user is None: return "Server misconfigured", 500 roles = roles.split(" ") @@ -56,13 +57,14 @@ def lookup_user(): for r in roles: a = r.split(":", 1) - val = a[1] - if a[0] not in g.roles: - g.roles[a[0]] = [] - if val == "*": - g.roles[a[0]] = [group for group in prefix[request.host]] - else: - g.roles[a[0]].append(val) + if len(r)!=0: + val = a[1] + if a[0] not in g.roles: + g.roles[a[0]] = [] + if val == "*": + g.roles[a[0]] = [group for group in prefix[request.host]] + else: + g.roles[a[0]].append(val) return None def get_allowed_cats(action): -- 2.39.2