0

How can I better protect access to all site reports within /admin/reports/ (except for Recent log messages)? I know I can hide it through CSS or disable the menu in management menu, but is there a better way to disable it?

I have these role defined (apart from Anonymous and Authenticated):

  • System Developer (can view all reports).
  • Admin (can only view 'Recent log messages').

Is there any Drupal function or hook that I can use to reach my goal?

1

Remove the permission for "Admin" to "access site reports" at

Admin > People > Permissions.

Add hook_menu_alter to a custom module, this part changes the access permission for the admin/reports/dblog menu path

/**
 * Implements hook_menu_alter
 */
function MYMODULE_menu_alter(&$items){
  // Allow access for administrator role to recent log entries
  // Use suitable permission here, e.g editorial "administer nodes"
  $items['admin/reports/dblog']['access arguments'] => array('administer nodes'), 
}

Clear menu cache, done.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.