From: Ismaƫl Bouya Date: Wed, 20 Jan 2021 22:40:40 +0000 (+0100) Subject: Allow only admin to download a video X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=f49b8d9b697f098490e81ce0afd889ba37dcb2f3;p=github%2FChocobozzz%2FPeerTube.git Allow only admin to download a video --- diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index c757a5e93..2b56d5064 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts @@ -239,7 +239,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { } isVideoDownloadable () { - return this.video && this.video instanceof VideoDetails && this.video.downloadEnabled && !this.video.isLive + return this.video && this.video instanceof VideoDetails && this.video.isDownloadableBy(this.user) && !this.video.isLive } loadCompleteDescription () { diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts index d51dfbc6d..fb00c11ff 100644 --- a/client/src/app/shared/shared-main/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts @@ -179,6 +179,10 @@ export class Video implements VideoServerModel { return serverConfig.instance.defaultNSFWPolicy !== 'display' } + isDownloadableBy (user: AuthUser) { + return user && this.isLocal === true && user.hasRight(UserRight.SEE_ALL_VIDEOS) + } + isRemovableBy (user: AuthUser) { return user && this.isLocal === true && user.hasRight(UserRight.REMOVE_ANY_VIDEO) } diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts index 3c2b46d16..2bc9bf7e4 100644 --- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts @@ -163,7 +163,7 @@ export class VideoActionsDropdownComponent implements OnChanges { return this.video && this.video.isLive !== true && this.video instanceof VideoDetails && - this.video.downloadEnabled + this.video.isDownloadableBy(this.user) } canVideoBeDuplicated () {