@@ -160,6 +160,11 @@ public function getFiles()
160160 */
161161 public function deleteFiles ()
162162 {
163+ if (!$ this ->app ->getIdentity ()->authorise ('core.delete ' , 'com_media ' ))
164+ {
165+ throw new \Exception (Text::_ ('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED ' ), 403 );
166+ }
167+
163168 $ this ->getModel ()->delete ($ this ->getAdapter (), $ this ->getPath ());
164169
165170 return null ;
@@ -191,6 +196,11 @@ public function deleteFiles()
191196 */
192197 public function postFiles ()
193198 {
199+ if (!$ this ->app ->getIdentity ()->authorise ('core.create ' , 'com_media ' ))
200+ {
201+ throw new \Exception (Text::_ ('JLIB_APPLICATION_ERROR_CREATE_RECORD_NOT_PERMITTED ' ), 403 );
202+ }
203+
194204 $ adapter = $ this ->getAdapter ();
195205 $ path = $ this ->getPath ();
196206 $ content = $ this ->input ->json ;
@@ -257,6 +267,11 @@ public function postFiles()
257267 */
258268 public function putFiles ()
259269 {
270+ if (!$ this ->app ->getIdentity ()->authorise ('core.edit ' , 'com_media ' ))
271+ {
272+ throw new \Exception (Text::_ ('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED ' ), 403 );
273+ }
274+
260275 $ adapter = $ this ->getAdapter ();
261276 $ path = $ this ->getPath ();
262277
@@ -344,11 +359,6 @@ public function getModel($name = 'Api', $prefix = 'Administrator', $config = [])
344359 */
345360 private function checkContent ()
346361 {
347- if (!$ this ->app ->getIdentity ()->authorise ('core.create ' , 'com_media ' ))
348- {
349- throw new \Exception (Text::_ ('COM_MEDIA_ERROR_CREATE_NOT_PERMITTED ' ), 403 );
350- }
351-
352362 $ params = ComponentHelper::getParams ('com_media ' );
353363
354364 $ helper = new MediaHelper ;
0 commit comments