From 954605a804da399317ca62afa2fb9244afa11ebf Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 27 Oct 2017 16:55:03 +0200 Subject: Support roles with rights and add moderator role --- client/src/app/videos/shared/video-details.model.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'client/src/app/videos/shared') 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 @@ import { Video } from './video.model' +import { AuthUser } from '../../core' import { VideoDetails as VideoDetailsServerModel, VideoFile, VideoChannel, - VideoResolution + VideoResolution, + UserRight } from '../../../../../shared' export class VideoDetails extends Video implements VideoDetailsServerModel { @@ -61,15 +63,15 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { return betterResolutionFile.magnetUri } - isRemovableBy (user) { - return user && this.isLocal === true && (this.author === user.username || user.isAdmin() === true) + isRemovableBy (user: AuthUser) { + return user && this.isLocal === true && (this.author === user.username || user.hasRight(UserRight.REMOVE_ANY_VIDEO)) } - isBlackistableBy (user) { - return user && user.isAdmin() === true && this.isLocal === false + isBlackistableBy (user: AuthUser) { + return user && user.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) === true && this.isLocal === false } - isUpdatableBy (user) { + isUpdatableBy (user: AuthUser) { return user && this.isLocal === true && user.username === this.author } } -- cgit v1.2.3