aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-03-18 10:22:36 +0100
committerChocobozzz <me@florianbigard.com>2020-03-18 10:22:36 +0100
commita31bec51554261b1f67cdd4ebdb6afba4d8ee65a (patch)
treebf5c10864fd4f9c47761e661817864bd4502b30c /client/src/app
parentfad0759cab414731060733df74d4244a13b543e1 (diff)
downloadPeerTube-a31bec51554261b1f67cdd4ebdb6afba4d8ee65a.tar.gz
PeerTube-a31bec51554261b1f67cdd4ebdb6afba4d8ee65a.tar.zst
PeerTube-a31bec51554261b1f67cdd4ebdb6afba4d8ee65a.zip
Fix user role edition
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.component.html2
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.ts11
2 files changed, 9 insertions, 4 deletions
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 @@
49 <label i18n for="role">Role</label> 49 <label i18n for="role">Role</label>
50 <div class="peertube-select-container"> 50 <div class="peertube-select-container">
51 <select id="role" formControlName="role"> 51 <select id="role" formControlName="role">
52 <option *ngFor="let role of getRoles()" [value]="role.value"> 52 <option *ngFor="let role of roles" [value]="role.value">
53 {{ role.label }} 53 {{ role.label }}
54 </option> 54 </option>
55 </select> 55 </select>
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 {
11 username: string 11 username: string
12 userId: number 12 userId: number
13 13
14 roles: { value: string, label: string }[] = []
15
14 protected serverConfig: ServerConfig 16 protected serverConfig: ServerConfig
15 17
16 protected abstract serverService: ServerService 18 protected abstract serverService: ServerService
@@ -23,17 +25,20 @@ export abstract class UserEdit extends FormReactive implements OnInit {
23 this.serverConfig = this.serverService.getTmpConfig() 25 this.serverConfig = this.serverService.getTmpConfig()
24 this.serverService.getConfig() 26 this.serverService.getConfig()
25 .subscribe(config => this.serverConfig = config) 27 .subscribe(config => this.serverConfig = config)
28
29 this.buildRoles()
26 } 30 }
27 31
28 getRoles () { 32 buildRoles () {
29 const authUser = this.auth.getUser() 33 const authUser = this.auth.getUser()
30 34
31 if (authUser.role === UserRole.ADMINISTRATOR) { 35 if (authUser.role === UserRole.ADMINISTRATOR) {
32 return Object.keys(USER_ROLE_LABELS) 36 this.roles = Object.keys(USER_ROLE_LABELS)
33 .map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) 37 .map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] }))
38 return
34 } 39 }
35 40
36 return [ 41 this.roles = [
37 { value: UserRole.USER.toString(), label: USER_ROLE_LABELS[UserRole.USER] } 42 { value: UserRole.USER.toString(), label: USER_ROLE_LABELS[UserRole.USER] }
38 ] 43 ]
39 } 44 }