File tree Expand file tree Collapse file tree
administrator/components/com_modules/src/Model Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -220,10 +220,28 @@ protected function translate(&$items)
220220 {
221221 $ lang = Factory::getLanguage ();
222222 $ clientPath = $ this ->getState ('client_id ' ) ? JPATH_ADMINISTRATOR : JPATH_SITE ;
223+ $ user = Factory::getApplication ()->getIdentity ();
223224
224- foreach ($ items as $ item ) {
225+ foreach ($ items as $ key => $ item ) {
225226 $ extension = $ item ->module ;
226227 $ source = $ clientPath . "/modules/ $ extension " ;
228+
229+ $ path = $ source . '/ ' . $ extension . '.xml ' ;
230+
231+ if (file_exists ($ path )) {
232+ $ xml = simplexml_load_file ($ path );
233+
234+ if (isset ($ xml ->permissions )) {
235+ $ action = (string ) $ xml ->permissions ;
236+ $ asset = isset ($ xml ->permissions ->attributes ()->asset ) ? (string ) $ xml ->permissions ->attributes ()->asset : null ;
237+
238+ if (!$ user ->authorise ($ action , $ asset )) {
239+ unset($ items [$ key ]);
240+ continue ;
241+ }
242+ }
243+ }
244+
227245 $ lang ->load ("$ extension.sys " , $ clientPath )
228246 || $ lang ->load ("$ extension.sys " , $ source );
229247 $ item ->name = Text::_ ($ item ->name );
You can’t perform that action at this time.
0 commit comments