From a31bec51554261b1f67cdd4ebdb6afba4d8ee65a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 18 Mar 2020 10:22:36 +0100 Subject: Fix user role edition --- .../src/app/+admin/users/user-edit/user-edit.component.html | 2 +- client/src/app/+admin/users/user-edit/user-edit.ts | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'client/src/app/+admin/users') diff --git a/client/src/app/+admin/users/user-edit/user-edit.component.html b/client/src/app/+admin/users/user-edit/user-edit.component.html index 2aca5ddca..dbb0e36b9 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.component.html +++ b/client/src/app/+admin/users/user-edit/user-edit.component.html @@ -49,7 +49,7 @@
diff --git a/client/src/app/+admin/users/user-edit/user-edit.ts b/client/src/app/+admin/users/user-edit/user-edit.ts index 02f1dcd42..47b57d2ec 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts @@ -11,6 +11,8 @@ export abstract class UserEdit extends FormReactive implements OnInit { username: string userId: number + roles: { value: string, label: string }[] = [] + protected serverConfig: ServerConfig protected abstract serverService: ServerService @@ -23,17 +25,20 @@ export abstract class UserEdit extends FormReactive implements OnInit { this.serverConfig = this.serverService.getTmpConfig() this.serverService.getConfig() .subscribe(config => this.serverConfig = config) + + this.buildRoles() } - getRoles () { + buildRoles () { const authUser = this.auth.getUser() if (authUser.role === UserRole.ADMINISTRATOR) { - return Object.keys(USER_ROLE_LABELS) + this.roles = Object.keys(USER_ROLE_LABELS) .map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) + return } - return [ + this.roles = [ { value: UserRole.USER.toString(), label: USER_ROLE_LABELS[UserRole.USER] } ] } -- cgit v1.2.3