diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2021-01-20 23:40:40 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2021-01-21 00:16:34 +0100 |
commit | f49b8d9b697f098490e81ce0afd889ba37dcb2f3 (patch) | |
tree | 4d9589d1e59af0e1f2763511c902a9ce10a1b39c | |
parent | f8aa0154b6638cee878db312918b03332d49e458 (diff) | |
download | PeerTube-gitolite_local/open_instance.tar.gz PeerTube-gitolite_local/open_instance.tar.zst PeerTube-gitolite_local/open_instance.zip |
Allow only admin to download a videogitolite_local/open_instance
3 files changed, 6 insertions, 2 deletions
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 { | |||
239 | } | 239 | } |
240 | 240 | ||
241 | isVideoDownloadable () { | 241 | isVideoDownloadable () { |
242 | return this.video && this.video instanceof VideoDetails && this.video.downloadEnabled && !this.video.isLive | 242 | return this.video && this.video instanceof VideoDetails && this.video.isDownloadableBy(this.user) && !this.video.isLive |
243 | } | 243 | } |
244 | 244 | ||
245 | loadCompleteDescription () { | 245 | 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 { | |||
179 | return serverConfig.instance.defaultNSFWPolicy !== 'display' | 179 | return serverConfig.instance.defaultNSFWPolicy !== 'display' |
180 | } | 180 | } |
181 | 181 | ||
182 | isDownloadableBy (user: AuthUser) { | ||
183 | return user && this.isLocal === true && user.hasRight(UserRight.SEE_ALL_VIDEOS) | ||
184 | } | ||
185 | |||
182 | isRemovableBy (user: AuthUser) { | 186 | isRemovableBy (user: AuthUser) { |
183 | return user && this.isLocal === true && user.hasRight(UserRight.REMOVE_ANY_VIDEO) | 187 | return user && this.isLocal === true && user.hasRight(UserRight.REMOVE_ANY_VIDEO) |
184 | } | 188 | } |
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 { | |||
163 | return this.video && | 163 | return this.video && |
164 | this.video.isLive !== true && | 164 | this.video.isLive !== true && |
165 | this.video instanceof VideoDetails && | 165 | this.video instanceof VideoDetails && |
166 | this.video.downloadEnabled | 166 | this.video.isDownloadableBy(this.user) |
167 | } | 167 | } |
168 | 168 | ||
169 | canVideoBeDuplicated () { | 169 | canVideoBeDuplicated () { |