From: INOPIAE Date: Tue, 18 Jun 2019 18:22:18 +0000 (+0200) Subject: upd: fixes problem if no special rights are granted to user X-Git-Url: https://code.wpia.club/?p=motion.git;a=commitdiff_plain;h=5cd320964ca249449fb08a68c4ca18e8bda1e98b upd: fixes problem if no special rights are granted to user --- 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):