Skip to content
Snippets Groups Projects
Commit 2b4b6561 authored by Mart van Santen's avatar Mart van Santen
Browse files

pylint advice

parent 013a7438
No related branches found
No related tags found
1 merge request!71Resolve "Admin logins should gain admin privileges"
Pipeline #10671 failed with stages
in 1 minute and 15 seconds
......@@ -170,25 +170,24 @@ def setrole(email, app_slug, role):
:param app_slug: Slug name of the app, for example 'nextcloud'
:param role: Role to assign. currently only 'admin', 'user'
"""
app.logger.info(f"Assiging role {role} to {email} for app {app_slug}")
# Find user
user = KratosUser.find_by_email(KRATOS_ADMIN, email)
if role != 'admin' and role != 'user':
if role not in ('admin', 'user'):
print("At this point only the roles 'admin' and 'user' are accepted")
sys.exit(1)
return
if not user:
print("User not found. Abort")
sys.exit(1)
return
app_obj = db.session.query(App).filter(App.slug==app_slug).first()
if not app_obj:
print("App not found. Abort.")
sys.exit(1)
return
role_obj = db.session.query(AppRole).\
filter(AppRole.app_id==app_obj.id).\
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment