From 2b4b65612ad1c89ef3d4483cdc10d51734751d72 Mon Sep 17 00:00:00 2001 From: Mart van Santen <mart@greenhost.nl> Date: Tue, 21 Dec 2021 08:37:18 +0100 Subject: [PATCH] pylint advice --- login/app.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/login/app.py b/login/app.py index 183ec07..6de4c76 100644 --- a/login/app.py +++ b/login/app.py @@ -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).\ -- GitLab