From e2df63b78a38fd565830395f9c5952145a1e38a6 Mon Sep 17 00:00:00 2001 From: shimon Date: Tue, 14 Feb 2023 09:53:37 +0200 Subject: [PATCH] realtime events --- app/controllers/api/videos.php | 48 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/app/controllers/api/videos.php b/app/controllers/api/videos.php index 0562e37a81..24a0bf9ec1 100644 --- a/app/controllers/api/videos.php +++ b/app/controllers/api/videos.php @@ -62,7 +62,7 @@ function validateFilePermissions(Database $dbForProject, string $bucketId, strin App::post('/v1/videos') ->desc('Create Video') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.write') ->label('audits.event', 'video.create') ->label('audits.resource', 'video/{response.$id}') @@ -96,7 +96,7 @@ App::post('/v1/videos') App::delete('/v1/videos/:videoId') ->desc('Delete video') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.write') ->label('audits.event', 'video.delete') ->label('audits.resource', 'video/{request.videoId}') @@ -136,7 +136,7 @@ App::delete('/v1/videos/:videoId') App::put('/v1/videos/:videoId') ->desc('Update video') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.write') ->label('audits.event', 'video.update') ->label('audits.resource', 'video/{request.videoId}') @@ -185,7 +185,7 @@ App::put('/v1/videos/:videoId') App::get('/v1/videos/:videoId') ->desc('Get video ') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.namespace', 'videos') @@ -213,7 +213,7 @@ App::get('/v1/videos/:videoId') App::get('/v1/videos') ->desc('Get video list') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.namespace', 'videos') @@ -250,7 +250,7 @@ App::get('/v1/videos') App::post('/v1/videos/:videoId/subtitles') ->desc('Add subtitle to video') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.write') ->label('audits.event', 'subtitle.create') ->label('audits.resource', 'video/{response.videoId}/subtitle/{response.$id}') @@ -298,7 +298,7 @@ App::post('/v1/videos/:videoId/subtitles') App::patch('/v1/videos/:videoId/subtitles/:subtitleId') ->desc('Update video subtitle') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.write') ->label('audits.event', 'subtitle.update') ->label('audits.resource', 'video/{response.videoId}/subtitle/{response.$id}') @@ -340,7 +340,7 @@ App::patch('/v1/videos/:videoId/subtitles/:subtitleId') App::delete('/v1/videos/:videoId/subtitles/:subtitleId') ->desc('Delete video subtitle') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.write') ->label('audits.event', 'subtitle.delete') ->label('audits.resource', 'video/{request.videoId}/subtitle/{request.subtitleId}') @@ -382,7 +382,7 @@ App::delete('/v1/videos/:videoId/subtitles/:subtitleId') App::get('/v1/videos/:videoId/subtitles') ->desc('Get video subtitles') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.namespace', 'videos') @@ -415,7 +415,7 @@ App::get('/v1/videos/:videoId/subtitles') App::post('/v1/videos/:videoId/rendition') ->alias('/v1/videos/:videoId/rendition', []) ->desc('Create video rendition') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.write') ->label('audits.event', 'rendition.create') ->label('audits.resource', 'video/{response.videoId}/rendition/{response.$id}') @@ -459,7 +459,7 @@ App::post('/v1/videos/:videoId/rendition') App::delete('/v1/videos/:videoId/renditions/:renditionId') ->desc('Delete video rendition') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.write') ->label('event', 'videos.[videoIdId].renditions.[renditionId].delete') ->label('audits.event', 'rendition.delete') @@ -507,7 +507,7 @@ App::delete('/v1/videos/:videoId/renditions/:renditionId') App::get('/v1/videos/:videoId/renditions/:renditionId') ->desc('Get a single video rendition') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.namespace', 'videos') @@ -542,7 +542,7 @@ App::get('/v1/videos/:videoId/renditions/:renditionId') App::get('/v1/videos/:videoId/renditions') ->desc('Get video renditions') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.namespace', 'videos') @@ -580,7 +580,7 @@ App::get('/v1/videos/:videoId/renditions') App::get('/v1/videos/:videoId/outputs/:output') ->desc('Get video master renditions manifest') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT]) ->label('sdk.namespace', 'videos') ->label('sdk.method', 'getMasterManifest') @@ -740,7 +740,7 @@ App::get('/v1/videos/:videoId/outputs/:output') App::get('/v1/videos/:videoId/outputs/:output/renditions/:renditionId/streams/:streamId') ->desc('Get video rendition manifest') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT]) ->label('sdk.namespace', 'videos') ->label('sdk.method', 'getManifest') @@ -803,7 +803,7 @@ App::get('/v1/videos/:videoId/outputs/:output/renditions/:renditionId/streams/:s App::get('/v1/videos/:videoId/outputs/:output/renditions/:renditionId/segments/:segmentId') ->desc('Get video rendition segment') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT]) ->label('sdk.namespace', 'videos') ->label('sdk.method', 'getRenditionSegment') @@ -839,7 +839,7 @@ App::get('/v1/videos/:videoId/outputs/:output/renditions/:renditionId/segments/: App::get('/v1/videos/:videoId/outputs/:output/subtitles/:subtitleId') ->desc('Get video subtitle') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT]) ->label('sdk.namespace', 'videos') ->label('sdk.method', 'getSubtitle') @@ -904,7 +904,7 @@ App::get('/v1/videos/:videoId/outputs/:output/subtitles/:subtitleId') App::get('/v1/videos/:videoId/outputs/:output/subtitles/:subtitleId/segments/:segmentId') ->desc('Get video subtitle segment') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT]) ->label('sdk.namespace', 'videos') ->label('sdk.method', 'getSubtitleSegment') @@ -942,7 +942,7 @@ App::get('/v1/videos/:videoId/outputs/:output/subtitles/:subtitleId/segments/:se App::post('/v1/videos/profiles') ->desc('Create video profile') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.write') ->label('audits.event', 'profile.create') ->label('audits.resource', 'profile/{response.$id}') @@ -980,7 +980,7 @@ App::post('/v1/videos/profiles') App::patch('/v1/videos/profiles/:profileId') ->desc('Update video profile') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.write') ->label('audits.event', 'profile.update') ->label('audits.resource', 'profile/{request.profileId}') @@ -1021,7 +1021,7 @@ App::patch('/v1/videos/profiles/:profileId') App::get('/v1/videos/profiles/:profileId') ->desc('Get video profile') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.namespace', 'videos') @@ -1045,7 +1045,7 @@ App::get('/v1/videos/profiles/:profileId') App::get('/v1/videos/profiles') ->desc('Get all video profiles') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.read') ->label('sdk.auth', [APP_AUTH_TYPE_KEY]) ->label('sdk.namespace', 'videos') @@ -1071,7 +1071,7 @@ App::get('/v1/videos/profiles') App::delete('/v1/videos/profiles/:profileId') ->desc('Delete video profile') - ->groups(['api', 'video']) + ->groups(['api', 'videos']) ->label('scope', 'videos.write') ->label('audits.event', 'profile.delete') ->label('audits.resource', 'profile/{request.profileId}') @@ -1094,7 +1094,7 @@ App::delete('/v1/videos/profiles/:profileId') $deleted = $dbForProject->deleteDocument('videos_profiles', $profileId); if (!$deleted) { - throw new Exception('Failed to remove video profile from DB', 500, Exception::GENERAL_SERVER_ERROR); + throw new Exception('Failed to delete video profile', 500, Exception::GENERAL_SERVER_ERROR); } $response->noContent();