[password-resets] Do banned teams checking correctly



commit eadc4c969bde49ca2bc9dd72e42377ac26ab388c
Author: Andrea Veri <averi redhat com>
Date:   Fri Nov 13 00:50:58 2020 +0100

    Do banned teams checking correctly

 app.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/app.py b/app.py
index 6c32fea..7cf41b8 100644
--- a/app.py
+++ b/app.py
@@ -73,10 +73,12 @@ def form_reset_get(request: Request, token: str):
     token = Session.query(Token).filter(Token.token==token)[0]
 
     if not (token.claimed or token.expired):
-        accountsteam =  glu.get_group_from_ldap('accounts')
-        sysadminteam =  glu.get_group_from_ldap('sysadmin')
+        from itertools import chain
 
-        if token.username not in (accountsteam or sysadminteam):
+        infrateam = chain(glu.get_group_from_ldap('accounts'), glu.get_group_from_ldap('sysadmin'), \
+            glu.get_group_from_ldap('admins'))
+
+        if token.username not in infrateam:
             return templates.TemplateResponse('form-reset.html', context={'request': request})
 
     return templates.TemplateResponse('general-form.html', context={'request': request, 'badtoken': True})


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]