From 5756211401f3b33fbf1ab353c287207742cd6cda Mon Sep 17 00:00:00 2001 From: Dennis Benz Date: Fri, 10 Jan 2025 15:57:36 +0100 Subject: [PATCH] Add episode id roles to user provider These roles are supported from Opencast version 17. See details in https://docs.opencast.org/r/17.x/admin/#configuration/episode-id-roles/#episode-id-roles. --- lib/Routes/Opencast/UserRoles.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Routes/Opencast/UserRoles.php b/lib/Routes/Opencast/UserRoles.php index 97b835fc..02a36828 100644 --- a/lib/Routes/Opencast/UserRoles.php +++ b/lib/Routes/Opencast/UserRoles.php @@ -50,6 +50,7 @@ public function __invoke(Request $request, Response $response, $args) $video_share = VideosShares::findByUuid($share_uuid); if (!empty($video_share)) { $roles[] = $video_share->video->episode . '_read'; + $roles[] = 'ROLE_EPISODE_' . $video_share->video->episode . '_READ'; } else { throw new Error('Share not found', 404); } @@ -95,8 +96,11 @@ public function __invoke(Request $request, Response $response, $args) if ($vperm->perm == 'owner' || $vperm->perm == 'write') { $roles[$vperm->video->episode . '_write'] = $vperm->video->episode . '_write'; + $roles['ROLE_EPISODE_' . $vperm->video->episode . '_READ'] = 'ROLE_EPISODE_' . $vperm->video->episode . '_READ'; + $roles['ROLE_EPISODE_' . $vperm->video->episode . '_WRITE'] = 'ROLE_EPISODE_' . $vperm->video->episode . '_WRITE'; } else { $roles[$vperm->video->episode . '_read'] = $vperm->video->episode . '_read'; + $roles['ROLE_EPISODE_' . $vperm->video->episode . '_READ'] = 'ROLE_EPISODE_' . $vperm->video->episode . '_READ'; } } @@ -110,6 +114,7 @@ public function __invoke(Request $request, Response $response, $args) while($episode = $stmt_courseware->fetchColumn()) { $roles[$episode . '_read'] = $episode . '_read'; + $roles['ROLE_EPISODE_' . $episode . '_READ'] = 'ROLE_EPISODE_' . $episode . '_READ'; } $stmt_courses = \DBManager::get()->prepare("SELECT seminar_id FROM seminar_user