@@ -280,30 +280,29 @@ public function checkAddAttribute()
280280 * Proxy to ReCodEx that adds an attribute to a group.
281281 * This is rather low-level operation for super-admins only (to edit top-level and term groups).
282282 * @POST
283- * @Param(type="post ", name="groupId ", validation="string:1..",
283+ * @Param(type="query ", name="id ", validation="string:1..",
284284 * description="ReCodEx ID of a group to which the attribute will be added.")
285285 * @Param(type="post", name="key", validation="string:1..",
286286 * description="Key of the attribute to add.")
287287 * @Param(type="post", name="value", validation="string:1..",
288288 * description="Value of the attribute to add.")
289289 */
290- public function actionAddAttribute ()
290+ public function actionAddAttribute (string $ id )
291291 {
292- $ groupId = $ this ->getRequest ()->getPost ('groupId ' );
293292 $ key = $ this ->getRequest ()->getPost ('key ' );
294293 $ value = $ this ->getRequest ()->getPost ('value ' );
295294
296295 $ groups = $ this ->recodexApi ->getGroups ($ this ->getCurrentUser ());
297- $ group = $ groups [$ groupId ] ?? null ;
296+ $ group = $ groups [$ id ] ?? null ;
298297 if ($ group === null ) {
299- throw new BadRequestException ("Group $ groupId does not exist or is not accessible by the user. " );
298+ throw new BadRequestException ("Group $ id does not exist or is not accessible by the user. " );
300299 }
301300
302301 if ($ group ->hasAttribute ($ key , $ value )) {
303- throw new BadRequestException ("Group $ groupId already has attribute $ key= $ value. " );
302+ throw new BadRequestException ("Group $ id already has attribute $ key= $ value. " );
304303 }
305304
306- $ this ->recodexApi ->addAttribute ($ groupId , $ key , $ value );
305+ $ this ->recodexApi ->addAttribute ($ id , $ key , $ value );
307306 $ this ->sendSuccessResponse ("OK " );
308307 }
309308
@@ -318,30 +317,29 @@ public function checkRemoveAttribute()
318317 * Proxy to ReCodEx that removes an attribute from a group.
319318 * This is rather low-level operation for super-admins only (to edit top-level and term groups).
320319 * @POST
321- * @Param(type="post ", name="groupId ", validation="string:1..",
320+ * @Param(type="query ", name="id ", validation="string:1..",
322321 * description="ReCodex ID of a group from which the attribute will be removed.")
323322 * @Param(type="post", name="key", validation="string:1..",
324323 * description="Key of the attribute to remove.")
325324 * @Param(type="post", name="value", validation="string:1..",
326325 * description="Value of the attribute to remove.")
327326 */
328- public function actionRemoveAttribute ()
327+ public function actionRemoveAttribute (string $ id )
329328 {
330- $ groupId = $ this ->getRequest ()->getPost ('groupId ' );
331329 $ key = $ this ->getRequest ()->getPost ('key ' );
332330 $ value = $ this ->getRequest ()->getPost ('value ' );
333331
334332 $ groups = $ this ->recodexApi ->getGroups ($ this ->getCurrentUser ());
335- $ group = $ groups [$ groupId ] ?? null ;
333+ $ group = $ groups [$ id ] ?? null ;
336334 if ($ group === null ) {
337- throw new BadRequestException ("Group $ groupId does not exist or is not accessible by the user. " );
335+ throw new BadRequestException ("Group $ id does not exist or is not accessible by the user. " );
338336 }
339337
340338 if (!$ group ->hasAttribute ($ key , $ value )) {
341- throw new BadRequestException ("Group $ groupId does not have attribute $ key= $ value. " );
339+ throw new BadRequestException ("Group $ id does not have attribute $ key= $ value. " );
342340 }
343341
344- $ this ->recodexApi ->removeAttribute ($ groupId , $ key , $ value );
342+ $ this ->recodexApi ->removeAttribute ($ id , $ key , $ value );
345343 $ this ->sendSuccessResponse ("OK " );
346344 }
347345}
0 commit comments