@@ -230,30 +230,43 @@ export default {
230
230
}
231
231
},
232
232
233
- loadVideos () {
233
+ loadVideos ()
234
+ {
234
235
let view = this ;
235
- view .loadingVideos = true ;
236
- const params = new URLSearchParams ();
237
- params .append (' offset' , this .paging .currPage * this .limit );
238
- params .append (' limit' , this .limit );
239
- if (this .sortObj ) {
240
- params .append (' order' , this .sortObj .field + " _" + this .sortObj .order )
241
- }
242
- if (this .searchText ) {
243
- let filters = [{
244
- type: ' text' ,
245
- value: this .searchText
246
- }];
247
- params .append (' filters' , JSON .stringify (filters));
236
+
237
+ // if user can edit this block, load all accesible videos
238
+ if (this .canEdit ) {
239
+ view .loadingVideos = true ;
240
+ const params = new URLSearchParams ();
241
+ params .append (' offset' , this .paging .currPage * this .limit );
242
+ params .append (' limit' , this .limit );
243
+ if (this .sortObj ) {
244
+ params .append (' order' , this .sortObj .field + " _" + this .sortObj .order )
245
+ }
246
+ if (this .searchText ) {
247
+ let filters = [{
248
+ type: ' text' ,
249
+ value: this .searchText
250
+ }];
251
+ params .append (' filters' , JSON .stringify (filters));
252
+ }
253
+ axios
254
+ .get (STUDIP .ABSOLUTE_URI_STUDIP + ' plugins.php/opencastv3/api/videos' , { params })
255
+ .then (({ data }) => {
256
+ view .paging .items = parseInt (data .count );
257
+ view .paging .lastPage = parseInt (view .paging .items / view .limit );
258
+ view .videos = data .videos ;
259
+ view .loadingVideos = false ;
260
+ })
261
+ } else {
262
+ // load only the current video if user has no edit perms
263
+ axios
264
+ .get (STUDIP .ABSOLUTE_URI_STUDIP + ' plugins.php/opencastv3/api/videos/' + view .currentVideoId )
265
+ .then (({ data }) => {
266
+ view .videos = [];
267
+ view .videos .push (data .video );
268
+ });
248
269
}
249
- axios
250
- .get (STUDIP .ABSOLUTE_URI_STUDIP + ' plugins.php/opencastv3/api/videos' , { params })
251
- .then (({ data }) => {
252
- view .paging .items = parseInt (data .count );
253
- view .paging .lastPage = parseInt (view .paging .items / view .limit );
254
- view .videos = data .videos ;
255
- view .loadingVideos = false ;
256
- })
257
270
},
258
271
259
272
checkLTIAuthentication (server)
0 commit comments