aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/users/user-edit/user-edit.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-30 09:59:19 +0200
committerChocobozzz <me@florianbigard.com>2019-07-30 09:59:19 +0200
commita95a4cc89155f448e6f9ca0957170f3c72a9d964 (patch)
treef390fa3eccef0991db5694ef58d6716228a7f67a /client/src/app/+admin/users/user-edit/user-edit.ts
parentdc8902634864841be7ca483b8e1c0f5afa609c32 (diff)
downloadPeerTube-a95a4cc89155f448e6f9ca0957170f3c72a9d964.tar.gz
PeerTube-a95a4cc89155f448e6f9ca0957170f3c72a9d964.tar.zst
PeerTube-a95a4cc89155f448e6f9ca0957170f3c72a9d964.zip
Moderators can only manage users
Diffstat (limited to 'client/src/app/+admin/users/user-edit/user-edit.ts')
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.ts20
1 files changed, 16 insertions, 4 deletions
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 ee6d2c489..6625d65d6 100644
--- a/client/src/app/+admin/users/user-edit/user-edit.ts
+++ b/client/src/app/+admin/users/user-edit/user-edit.ts
@@ -1,22 +1,34 @@
1import { ServerService } from '../../../core' 1import { AuthService, ServerService } from '../../../core'
2import { FormReactive } from '../../../shared' 2import { FormReactive } from '../../../shared'
3import { USER_ROLE_LABELS, VideoResolution } from '../../../../../../shared' 3import { USER_ROLE_LABELS, UserRole, VideoResolution } from '../../../../../../shared'
4import { ConfigService } from '@app/+admin/config/shared/config.service' 4import { ConfigService } from '@app/+admin/config/shared/config.service'
5import { UserAdminFlag } from '@shared/models/users/user-flag.model' 5import { UserAdminFlag } from '@shared/models/users/user-flag.model'
6 6
7export abstract class UserEdit extends FormReactive { 7export abstract class UserEdit extends FormReactive {
8 videoQuotaOptions: { value: string, label: string }[] = [] 8 videoQuotaOptions: { value: string, label: string }[] = []
9 videoQuotaDailyOptions: { value: string, label: string }[] = [] 9 videoQuotaDailyOptions: { value: string, label: string }[] = []
10 roles = Object.keys(USER_ROLE_LABELS)
11 .map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] }))
12 username: string 10 username: string
13 userId: number 11 userId: number
14 12
15 protected abstract serverService: ServerService 13 protected abstract serverService: ServerService
16 protected abstract configService: ConfigService 14 protected abstract configService: ConfigService
15 protected abstract auth: AuthService
17 abstract isCreation (): boolean 16 abstract isCreation (): boolean
18 abstract getFormButtonTitle (): string 17 abstract getFormButtonTitle (): string
19 18
19 getRoles () {
20 const authUser = this.auth.getUser()
21
22 if (authUser.role === UserRole.ADMINISTRATOR) {
23 return Object.keys(USER_ROLE_LABELS)
24 .map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] }))
25 }
26
27 return [
28 { value: UserRole.USER.toString(), label: USER_ROLE_LABELS[UserRole.USER] }
29 ]
30 }
31
20 isTranscodingInformationDisplayed () { 32 isTranscodingInformationDisplayed () {
21 const formVideoQuota = parseInt(this.form.value['videoQuota'], 10) 33 const formVideoQuota = parseInt(this.form.value['videoQuota'], 10)
22 34