diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-10-27 16:55:03 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-10-27 16:55:03 +0200 |
commit | 954605a804da399317ca62afa2fb9244afa11ebf (patch) | |
tree | de6ee69280bfb928bc01c29430e13d5b820e921a /client/src/app/shared | |
parent | e02573ad67626210ed279bad321ee139094921a1 (diff) | |
download | PeerTube-954605a804da399317ca62afa2fb9244afa11ebf.tar.gz PeerTube-954605a804da399317ca62afa2fb9244afa11ebf.tar.zst PeerTube-954605a804da399317ca62afa2fb9244afa11ebf.zip |
Support roles with rights and add moderator role
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/forms/form-validators/user.ts | 6 | ||||
-rw-r--r-- | client/src/app/shared/users/user.model.ts | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/client/src/app/shared/forms/form-validators/user.ts b/client/src/app/shared/forms/form-validators/user.ts index d4c4c1d33..e7473b75b 100644 --- a/client/src/app/shared/forms/form-validators/user.ts +++ b/client/src/app/shared/forms/form-validators/user.ts | |||
@@ -29,3 +29,9 @@ export const USER_VIDEO_QUOTA = { | |||
29 | 'min': 'Quota must be greater than -1.' | 29 | 'min': 'Quota must be greater than -1.' |
30 | } | 30 | } |
31 | } | 31 | } |
32 | export const USER_ROLE = { | ||
33 | VALIDATORS: [ Validators.required ], | ||
34 | MESSAGES: { | ||
35 | 'required': 'User role is required.', | ||
36 | } | ||
37 | } | ||
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts index 7beea5910..d738899ab 100644 --- a/client/src/app/shared/users/user.model.ts +++ b/client/src/app/shared/users/user.model.ts | |||
@@ -1,7 +1,9 @@ | |||
1 | import { | 1 | import { |
2 | User as UserServerModel, | 2 | User as UserServerModel, |
3 | UserRole, | 3 | UserRole, |
4 | VideoChannel | 4 | VideoChannel, |
5 | UserRight, | ||
6 | hasUserRight | ||
5 | } from '../../../../../shared' | 7 | } from '../../../../../shared' |
6 | 8 | ||
7 | export type UserConstructorHash = { | 9 | export type UserConstructorHash = { |
@@ -56,7 +58,7 @@ export class User implements UserServerModel { | |||
56 | } | 58 | } |
57 | } | 59 | } |
58 | 60 | ||
59 | isAdmin () { | 61 | hasRight (right: UserRight) { |
60 | return this.role === 'admin' | 62 | return hasUserRight(this.role, right) |
61 | } | 63 | } |
62 | } | 64 | } |