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/videos/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/videos/shared')
-rw-r--r-- | client/src/app/videos/shared/video-details.model.ts | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/client/src/app/videos/shared/video-details.model.ts b/client/src/app/videos/shared/video-details.model.ts index e99a5ce2e..3a6ecc480 100644 --- a/client/src/app/videos/shared/video-details.model.ts +++ b/client/src/app/videos/shared/video-details.model.ts | |||
@@ -1,9 +1,11 @@ | |||
1 | import { Video } from './video.model' | 1 | import { Video } from './video.model' |
2 | import { AuthUser } from '../../core' | ||
2 | import { | 3 | import { |
3 | VideoDetails as VideoDetailsServerModel, | 4 | VideoDetails as VideoDetailsServerModel, |
4 | VideoFile, | 5 | VideoFile, |
5 | VideoChannel, | 6 | VideoChannel, |
6 | VideoResolution | 7 | VideoResolution, |
8 | UserRight | ||
7 | } from '../../../../../shared' | 9 | } from '../../../../../shared' |
8 | 10 | ||
9 | export class VideoDetails extends Video implements VideoDetailsServerModel { | 11 | export class VideoDetails extends Video implements VideoDetailsServerModel { |
@@ -61,15 +63,15 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { | |||
61 | return betterResolutionFile.magnetUri | 63 | return betterResolutionFile.magnetUri |
62 | } | 64 | } |
63 | 65 | ||
64 | isRemovableBy (user) { | 66 | isRemovableBy (user: AuthUser) { |
65 | return user && this.isLocal === true && (this.author === user.username || user.isAdmin() === true) | 67 | return user && this.isLocal === true && (this.author === user.username || user.hasRight(UserRight.REMOVE_ANY_VIDEO)) |
66 | } | 68 | } |
67 | 69 | ||
68 | isBlackistableBy (user) { | 70 | isBlackistableBy (user: AuthUser) { |
69 | return user && user.isAdmin() === true && this.isLocal === false | 71 | return user && user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) === true && this.isLocal === false |
70 | } | 72 | } |
71 | 73 | ||
72 | isUpdatableBy (user) { | 74 | isUpdatableBy (user: AuthUser) { |
73 | return user && this.isLocal === true && user.username === this.author | 75 | return user && this.isLocal === true && user.username === this.author |
74 | } | 76 | } |
75 | } | 77 | } |