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 | |
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')
-rw-r--r-- | client/src/app/videos/shared/video-details.model.ts | 14 | ||||
-rw-r--r-- | client/src/app/videos/video-list/video-list.component.ts | 2 |
2 files changed, 9 insertions, 7 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 | } |
diff --git a/client/src/app/videos/video-list/video-list.component.ts b/client/src/app/videos/video-list/video-list.component.ts index 35a7b6521..bf6f60215 100644 --- a/client/src/app/videos/video-list/video-list.component.ts +++ b/client/src/app/videos/video-list/video-list.component.ts | |||
@@ -12,7 +12,7 @@ import { | |||
12 | VideoService, | 12 | VideoService, |
13 | VideoPagination | 13 | VideoPagination |
14 | } from '../shared' | 14 | } from '../shared' |
15 | import { Search, SearchField, SearchService, User} from '../../shared' | 15 | import { Search, SearchField, SearchService, User } from '../../shared' |
16 | 16 | ||
17 | @Component({ | 17 | @Component({ |
18 | selector: 'my-videos-list', | 18 | selector: 'my-videos-list', |