Drupal - 匿名用户访问路径

时间:2017-01-26 20:51:01

标签: drupal drupal-6

我创建了一个带有hook_menu函数的路径,该函数用于访问匿名用户。定义是:


     ##generic access point for API calls #
     items['api'] = array(
       'title' => 'api access point',
       'description' => 'Pass all api calls thru single access point to simplify code',
       'page callback' => 'xxxxxxx_utility_api',
       'access arguments' => array('access content'),
       'access callback' => TRUE,
       'type' => MENU_CALLBACK, );

路径www.mysite.com/api/aaa/bbb / ...

返回JSON

并且只要我登录就可以运行,但我需要允许匿名访问路径

如何配置drupal以允许匿名访问返回JSON的路径

1 个答案:

答案 0 :(得分:0)

您需要有2个级别并删除访问参数和下一个清除缓存菜单(drush cc菜单)

     items['api/custom'] = array(
       'title' => 'api access point',
       'description' => 'Pass all api calls thru single access point to simplify code',
       'page callback' => 'xxxxxxx_utility_api',
//       'access arguments' => array('access content'),
       'access callback' => TRUE,
       'type' => MENU_CALLBACK, );