Optimize insert app role to user
This commit is contained in:
parent
bc85575e9b
commit
09f1d2e00a
1 changed files with 3 additions and 4 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue