Skip to content

Commit

Permalink
fixes #1967, include link sharing in public making option
Browse files Browse the repository at this point in the history
  • Loading branch information
tgloeggl committed Nov 21, 2024
1 parent 3ebc54c commit 1b32cf3
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 5 deletions.
5 changes: 4 additions & 1 deletion lib/Routes/Video/VideoSharesList.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ class VideoSharesList extends OpencastController

public function __invoke(Request $request, Response $response, $args)
{

global $user;

if (!\Config::get()->OPENCAST_ALLOW_PUBLIC_SHARING) {
throw new \AccessDeniedException();
}

$token = $args['token'];
$video = Videos::findByToken($token);

Expand Down
4 changes: 4 additions & 0 deletions lib/Routes/Video/VideoSharesUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public function __invoke(Request $request, Response $response, $args)

global $user;

if (!\Config::get()->OPENCAST_ALLOW_PUBLIC_SHARING) {
throw new \AccessDeniedException();
}

$token = $args['token'];
$video = Videos::findByToken($token);

Expand Down
32 changes: 32 additions & 0 deletions migrations/097_update_sharing_option.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

class UpdateSharingOption extends Migration
{
public function description()
{
return 'Rename option to include link sharing as well';
}

public function up()
{
$db = DBManager::get();

// Add global config to edit clear interval of videos in recycle bin
$stmt = $db->prepare('REPLACE INTO config (field, value, section, type, `range`, mkdate, chdate, description)
VALUES (:name, :value, :section, :type, :range, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :description)');

$stmt->execute([
'name' => 'OPENCAST_ALLOW_PUBLIC_SHARING',
'section' => 'opencast',
'description' => 'Sollen Nutzende Videos teilen oder weltweit öffentlich freigeben können?',
'range' => 'global',
'type' => 'boolean',
'value' => true
]);
}

public function down()
{

}
}
13 changes: 9 additions & 4 deletions vueapp/components/Videos/Actions/VideoAccess.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
/>
</fieldset>
</form>
<form class="default">
<form class="default" v-if="config.settings.OPENCAST_ALLOW_PUBLIC_SHARING">
<fieldset>
<legend>
{{ $gettext('Share Links') }}
Expand Down Expand Up @@ -118,7 +118,7 @@
</table>
</fieldset>
<fieldset v-if="config.settings.OPENCAST_ALLOW_PUBLIC_SHARING">
<fieldset>
<legend>
{{ $gettext('Weltweiter Zugriff') }}
</legend>
Expand Down Expand Up @@ -339,8 +339,13 @@ export default {
},
},
mounted () {
this.initVideoShares();
mounted ()
{
this.$nextTick(() => {
if (this.config.settings.OPENCAST_ALLOW_PUBLIC_SHARING) {
this.initVideoShares();
}
});
},
}
</script>

0 comments on commit 1b32cf3

Please sign in to comment.