]> WPIA git - motion.git/commitdiff
upd: add configurable debug user
authorINOPIAE <m.maengel@inopiae.de>
Tue, 9 Apr 2019 20:38:12 +0000 (22:38 +0200)
committerINOPIAE <m.maengel@inopiae.de>
Sun, 22 Mar 2020 12:22:28 +0000 (13:22 +0100)
config.py.example
motion.py

index 3ad653f2a81cc4fa6e59bf9fee9de0c4a398b281..25b8123d431ac792cd8afe6f6acb2c1671f4e305 100644 (file)
@@ -7,3 +7,5 @@ DEFAULT_HOST="hostname for migration from db version < 2"
 GROUP_PREFIX={'hostname': {'group1': 'g1', 'group2': 'g2'}} # motion types and their id-prefixes
 
 DURATION={'hostname':[3, 7, 14]} # duration period for motions
+
+#DEBUGUSER={'hostname':'username/create:* vote:*'} # remove # at beginning of line to use local debuguser
index f835f99d53bdd277645c0284ff4035f98a9c8cba..eb04effb9844d7734e69549b93532a265110b391 100644 (file)
--- a/motion.py
+++ b/motion.py
@@ -22,12 +22,19 @@ prefix=app.config.get("GROUP_PREFIX")
 
 times=app.config.get("DURATION")
 
+debuguser=app.config.get("DEBUGUSER")
+
 @app.before_request
 def lookup_user():
     global prefix
 
     env = request.environ
     user = None
+    if debuguser is not None:
+        parts =debuguser[request.host].split("/", 1)
+        user = parts[0]
+        roles = parts[1]
+
     if "USER_ROLES" in env:
         parts = env.get("USER_ROLES").split("/", 1)
         user = parts[0]