]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Allow only admin to download a video gitolite_local/open_instance
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Wed, 20 Jan 2021 22:40:40 +0000 (23:40 +0100)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Wed, 20 Jan 2021 23:16:34 +0000 (00:16 +0100)
client/src/app/+videos/+video-watch/video-watch.component.ts
client/src/app/shared/shared-main/video/video.model.ts
client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts

index c757a5e9370413595d7564dea7a3d588981fb880..2b56d50644fdcd75adfc306816961bff132b7ac0 100644 (file)
@@ -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 () {
index d51dfbc6d485917619655e5b53dbbaf46e6a1315..fb00c11ffa1a342f29c6a12148d69e8c84617fc6 100644 (file)
@@ -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)
   }
index 3c2b46d16d68e41d4e196cc486c1a75ac8dcf856..2bc9bf7e49bf44a050c428405e649f62a75a215e 100644 (file)
@@ -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 () {