Guest User

Untitled

a guest
Oct 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. <?php
  2. $actions = JAccess::getActionsFromFile(JPATH_COMPONENT_ADMINISTRATOR.'/access.xml');
  3. $user = JFactory::getUser(398);
  4. foreach($actions as $action) {
  5. $result = $user->authorize($action->name, 'com_test');
  6. while(is_null($result) && $action->inherit != ''){
  7. $filter = array_filter($actions,
  8. function ($var) use ($action) {
  9. return ($var->name == $action->inherit);
  10. }
  11. );
  12. $action = array_shift($filter);
  13. $result = $user->authorize($action->name, 'com_test');
  14. }
  15. var_dump($action, $result);
  16. }
Add Comment
Please, Sign In to add comment