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


PHP ACLAction::userHasAccess方法代码示例

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


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

示例1: checkAccess

 function checkAccess($category, $action, $is_owner = false, $type = 'module')
 {
     global $current_user;
     if (is_admin($current_user)) {
         return true;
     }
     //calendar is a special case since it has 3 modules in it (calls, meetings, tasks)
     if ($category == 'Calendar') {
         return ACLAction::userHasAccess($current_user->id, 'Calls', $action, $type, $is_owner) || ACLAction::userHasAccess($current_user->id, 'Meetings', $action, 'module', $is_owner) || ACLAction::userHasAccess($current_user->id, 'Tasks', $action, 'module', $is_owner);
     }
     if ($category == 'Activities') {
         return ACLAction::userHasAccess($current_user->id, 'Calls', $action, $type, $is_owner) || ACLAction::userHasAccess($current_user->id, 'Meetings', $action, 'module', $is_owner) || ACLAction::userHasAccess($current_user->id, 'Tasks', $action, 'module', $is_owner) || ACLAction::userHasAccess($current_user->id, 'Emails', $action, 'module', $is_owner) || ACLAction::userHasAccess($current_user->id, 'Notes', $action, 'module', $is_owner);
     }
     return ACLAction::userHasAccess($current_user->id, $category, $action, $type, $is_owner);
 }
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:15,代码来源:ACLController.php

示例2: testuserHasAccess

 public function testuserHasAccess()
 {
     $this->assertFalse(ACLAction::userHasAccess('', '', ''));
     //test with empty module and action
     $this->assertTrue(ACLAction::userHasAccess('', 'Accounts', 'list'));
     //test with e,pty user and valid module and action
     $this->assertTrue(ACLAction::userHasAccess('1', 'Accounts', 'list'));
     //test with valid User, module and action
     $this->assertTrue(ACLAction::userHasAccess('1', 'SecurityGroups', 'list'));
     //test with valid User, module and action
     $this->assertTrue(ACLAction::userHasAccess('1', 'Users', 'list'));
     //test with valid User, module and action
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:13,代码来源:ACLActionTest.php

示例3: getUserAccess

 /**
  * Get user access for the list of actions
  * @param string $module
  * @param array $access_list List of actions
  * @returns array - List of access levels. Access levels not returned are assumed to be "all allowed".
  */
 public function getUserAccess($module, $access_list, $context)
 {
     $user = $this->getCurrentUser($context);
     if (empty($user) || empty($user->id) || is_admin($user)) {
         // no user or admin - do nothing
         return $access_list;
     }
     $is_owner = !(isset($context['owner_override']) && $context['owner_override'] == false);
     if (isset(self::$non_module_acls[$module])) {
         $level = self::$non_module_acls[$module];
     } else {
         $level = 'module';
     }
     $actions = ACLAction::getUserActions($user->id, false, $module, $level);
     if (empty($actions)) {
         return $access_list;
     }
     // default implementation, specific ACLs can override
     $access = $access_list;
     // check 'access' first - if it's false all others will be false
     if (isset($access_list['access'])) {
         if (!ACLAction::userHasAccess($user->id, $module, 'access', $level, true)) {
             foreach ($access_list as $action => $value) {
                 $access[$action] = false;
             }
             return $access;
         }
         // no need to check it second time
         unset($access_list['access']);
     }
     foreach ($access_list as $action => $value) {
         // may have the bean, so we need to use checkAccess
         if (!$this->checkAccess($module, $action, $context) || isset($actions[$action]['aclaccess']) && !ACLAction::hasAccess($is_owner, $actions[$action]['aclaccess'])) {
             $access[$action] = false;
         }
     }
     return $access;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:44,代码来源:SugarACLStatic.php


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