开发者

Drupal permissions are not being applied

Why are my permis开发者_运维知识库sions 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 access admin/mymodule

You've set it to always be TRUE which means it can always be accessed. I think you need to change it to something like:

'access callback' => 'user_access',
'access arguments' => array('admin mymodule'), 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜