我有一个模块,其中包含通过 AJAX 访问以执行不同任务的页面列表
/spower
/spower-geometry
...
. 我正在尝试创建一个允许匿名用户访问所有内容的权限。如果我以管理员身份登录,一切都会按预期进行。但是,匿名用户收到 403 错误。我需要为每条路径使用不同的权限挂钩吗?这是我到目前为止所拥有的:
function spower_permission() {
return array(
'access intro page' => array(
'title' => t('Access Intro page'),
'description' => t('Allow anonymous users to access spower intro page'),
),
'access SparkerPower app' => array(
'title' => t('Access full page'),
'description' => t('Allow users to access full spower app'),
),
);
}
function spower_menu() {
$items = array();
$items['spower'] = array(
'title' => t('SparkerPOWER'),
'page callback' => 'spower_form',
'access arguments' => array('access SparkerPower app'),
'description' => t('form for SparkerPOWER. Enter your house information, and learn how solar panels can help you.'),
'type' => MENU_CALLBACK,
);
$items['spower_geometry/%'] = array( //send data from Jquery (map areas)
'title' => 'Ajax callback',
'description' => 'Callback for jQuery area AJAX request.',
'page callback' => 'spower_geometry_callback',
'page arguments' => array(1),
'access arguments' => array('access spower geometry'),
'access callback' => 'user_access',
'type' => MENU_CALLBACK,
);
谢谢您的帮助!