当前位置: 首页>>代码示例>>PHP>>正文


PHP sapp_Global::generateAccessControl_helper方法代码示例

本文整理汇总了PHP中sapp_Global::generateAccessControl_helper方法的典型用法代码示例。如果您正苦于以下问题:PHP sapp_Global::generateAccessControl_helper方法的具体用法?PHP sapp_Global::generateAccessControl_helper怎么用?PHP sapp_Global::generateAccessControl_helper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sapp_Global的用法示例。


在下文中一共展示了sapp_Global::generateAccessControl_helper方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getControllersByRole

 /**
  * This function will give controllers related to particular role id.
  * @parameters
  * @param $role_id    =  id of role.
  * @returns  Array of controllers.
  */
 public function getControllersByRole($role_id)
 {
     $db = Zend_Db_Table::getDefaultAdapter();
     $query = "select m.menuName menuName,substring(m.url,2) url,SUBSTR(m.url,LOCATE('/',m.url)+1,(CHAR_LENGTH(m.url) - LOCATE('/',REVERSE(m.url)) - LOCATE('/',m.url))) nurl,p.addpermission,p.editpermission,p.deletepermission,p.viewpermission,\n                  p.uploadattachments,p.viewattachments from main_menu m inner join main_privileges p on p.object = m.id  \n                  where m.url != '/#' and m.isactive = 1 and p.isactive = 1 and p.role = " . $role_id;
     $result = $db->query($query);
     $url_arr = array();
     while ($row = $result->fetch()) {
         $url = $row['nurl'] == '' ? $row['url'] : $row['nurl'];
         $url_arr[$url . "controller.php"]['url'] = $url;
         if ($url != 'servicerequests') {
             $url_arr[$url . "controller.php"]['actions'] = $this->getControllersByRole_helper($row);
         } else {
             $service_actions = sapp_Global::generateAccessControl_helper(array('servicerequestscontroller.php' => array('url' => 'servicerequests')), 'random');
             $url_arr[$url . "controller.php"]['actions'] = $service_actions['servicerequestscontroller.php'];
         }
     }
     $index_arr = array();
     $index_arr['indexcontroller.php']['url'] = "index";
     $index_actions = sapp_Global::generateAccessControl_helper(array('indexcontroller.php' => array('url' => 'index')), 'random');
     $index_arr['indexcontroller.php']['actions'] = $index_actions['indexcontroller.php'];
     $index_arr['dashboardcontroller.php']['url'] = "dashboard";
     $dash_actions = sapp_Global::generateAccessControl_helper(array('dashboardcontroller.php' => array('url' => 'dashboard')), 'random');
     $index_arr['dashboardcontroller.php']['actions'] = $dash_actions['dashboardcontroller.php'];
     if ($role_id == SUPERADMINROLE) {
         $index_arr['managemenuscontroller.php']['url'] = "managemenus";
         $index_actions = sapp_Global::generateAccessControl_helper(array('managemenuscontroller.php' => array('url' => 'managemenus')), 'random');
         $index_arr['managemenuscontroller.php']['actions'] = $index_actions['managemenuscontroller.php'];
     }
     return $url_arr + $index_arr;
 }
开发者ID:lukkyrich,项目名称:sentrifugo,代码行数:36,代码来源:Menu.php


注:本文中的sapp_Global::generateAccessControl_helper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。