diff --git a/areas/users/user_service.py b/areas/users/user_service.py index 70ce78c..c75185d 100644 --- a/areas/users/user_service.py +++ b/areas/users/user_service.py @@ -81,13 +81,12 @@ class UserService: @staticmethod def __insertAppRoleToUser(userId, userRes): - app_role = AppRole.query.filter_by(user_id=userId) apps = App.query.all() - app_roles = [] - for app in apps: - tmp_app_role = app_role.filter_by(app_id=app.id).first() + tmp_app_role = AppRole.query.filter_by( + user_id=userId, app_id=app.id + ).first() app_roles.append( { "name": app.slug,