]> WPIA git - motion.git/commitdiff
upd: fixes problem if no special rights are granted to user
authorINOPIAE <m.maengel@inopiae.de>
Tue, 18 Jun 2019 18:22:18 +0000 (20:22 +0200)
committerINOPIAE <m.maengel@inopiae.de>
Tue, 18 Jun 2019 18:22:18 +0000 (20:22 +0200)
motion.py

index 24c86dec66347cbcf0b4f0c4531c06daa2936d6a..51f21dee8070a233c553e3f8e45169b612e494f8 100644 (file)
--- 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):