Skip to content

Commit aec7a83

Browse files
committed
Fix bug 21439: error occurred when sign in by local account
1 parent 5896f3a commit aec7a83

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

services/user_service.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,8 @@ def get_user(self, id):
7272
return User.objects.filter(id=id).first()
7373

7474
def get_roles(self, uid):
75-
users = UserRole.objects.filter(o365UserId=uid)
76-
if users:
77-
roles = []
78-
for user in users:
79-
roles.append(user.name)
80-
return roles
81-
return None
75+
roles = UserRole.objects.filter(o365UserId=uid).values_list('name', flat=True)
76+
return [x for x in roles]
8277

8378
def update_role(self, uid, role_name):
8479
role = UserRole.objects.get_or_create(o365UserId=uid)[0]

0 commit comments

Comments
 (0)