Why are my permissions not being applied?
$items['admin/mymodule'] = array(
'page callback' => 'mymodule_admin',
'access arguments' => array("admin mymodule"),
'access callback' => TRUE,
'type' => MENU_NORMAL_ITEM,
'file' => 'mymodule.admin.inc',
'title' => 'mymodule',
);
function mymodule_perm(){
return array("admin mymodule", "earnings_report");
}
When I go to Mysite/admin/mymodule, I am able to access it WITHOUT being logged in.
The permissions on admin/user/permissions are correctly set to only give access to "site developer" and "store administrator", and the anonymous user are not part of those roles.
I tried going to /admin/content/node-settings/rebuild and /admin/build/modules, but it didn't help.
The permission "earnings_report" is working as expected, but "admin mymodule" is not.
Thanks!
The
'access callback' => TRUE,line defines who can accessadmin/mymoduleYou’ve set it to always be TRUE which means it can always be accessed. I think you need to change it to something like: