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


PHP ACLAction::hasAccess方法代码示例

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


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

示例1: testhasAccess

 public function testhasAccess()
 {
     $this->assertFalse(ACLAction::hasAccess());
     //check with defaults
     $this->assertTrue(ACLAction::hasAccess(false, false, 90));
     //access All with is owner false
     $this->assertTrue(ACLAction::hasAccess(true, true, 90));
     //access All with is owner true
     $this->assertFalse(ACLAction::hasAccess(false, false, -98));
     // check access disabled
     $this->assertFalse(ACLAction::hasAccess(true, true, 89));
     //check access enabled
     $this->assertTrue(ACLAction::hasAccess(true, true, 75));
     //check owner access with is owner true
     $this->assertFalse(ACLAction::hasAccess(false, true, 75));
     //check owner access with is owner false
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:17,代码来源:ACLActionTest.php

示例2: userHasAccess

 /**
     public static function userHasAccess($user_id, $category, $action,$type='module', $is_owner = false){
 */
 public static function userHasAccess($user_id, $category, $action, $type = 'module', $is_owner = false, $in_group = false)
 {
     global $current_user;
     if ($current_user->isAdminForModule($category) && !isset($_SESSION['ACL'][$user_id][$category][$type][$action]['aclaccess'])) {
         return true;
     }
     //check if we don't have it set in the cache if not lets reload the cache
     if (ACLAction::getUserAccessLevel($user_id, $category, 'access', $type) < ACL_ALLOW_ENABLED) {
         return false;
     }
     if (empty($_SESSION['ACL'][$user_id][$category][$type][$action])) {
         ACLAction::getUserActions($user_id, false);
     }
     if (!empty($_SESSION['ACL'][$user_id][$category][$type][$action])) {
         /**
                     return ACLAction::hasAccess($is_owner, $_SESSION['ACL'][$user_id][$category][$type][$action]['aclaccess']);
         */
         return ACLAction::hasAccess($is_owner, $in_group, $_SESSION['ACL'][$user_id][$category][$type][$action]['aclaccess']);
     }
     return false;
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:24,代码来源:ACLAction.php

示例3: userHasAccess

 /**
  * static function userHasAccess($user_id, $category, $action, $is_owner = false)
  *
  * @param GUID $user_id the user id who you want to check access for
  * @param STRING $category the category you would like to check access for
  * @param STRING $action the action of that category you would like to check access for
  * @param BOOLEAN OPTIONAL $is_owner if the object is owned by the user you are checking access for
  */
 function userHasAccess($user_id, $category, $action, $type = 'module', $is_owner = false)
 {
     //check if we don't have it set in the cache if not lets reload the cache
     if (ACLAction::getUserAccessLevel($user_id, $category, 'access') < ACL_ALLOW_ENABLED) {
         return false;
     }
     if (empty($_SESSION['ACL'][$user_id][$category][$type][$action])) {
         ACLAction::getUserActions($user_id, false);
     }
     if (!empty($_SESSION['ACL'][$user_id][$category][$type][$action])) {
         return ACLAction::hasAccess($is_owner, $_SESSION['ACL'][$user_id][$category][$type][$action]['aclaccess']);
     }
     return false;
 }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:22,代码来源:ACLAction.php

示例4: 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

示例5: userHasAccess

 /**
  * static function userHasAccess($user_id, $category, $action, $is_owner = false)
  *
  * @param GUID $user_id the user id who you want to check access for
  * @param STRING $category the category you would like to check access for
  * @param STRING $action the action of that category you would like to check access for
  * @param BOOLEAN OPTIONAL $is_owner if the object is owned by the user you are checking access for
  */
 public static function userHasAccess($user_id, $category, $action, $type = 'module', $is_owner = false)
 {
     global $current_user;
     //check if we don't have it set in the cache if not lets reload the cache
     if (ACLAction::getUserAccessLevel($user_id, $category, 'access', $type) < ACL_ALLOW_ENABLED) {
         return false;
     }
     if (empty(self::$acls[$user_id][$category][$type][$action])) {
         ACLAction::getUserActions($user_id, false);
     }
     if (!empty(self::$acls[$user_id][$category][$type][$action])) {
         if ($action == 'access' && self::$acls[$user_id][$category][$type][$action]['aclaccess'] == ACL_ALLOW_ENABLED) {
             return true;
         }
         return ACLAction::hasAccess($is_owner, self::$acls[$user_id][$category][$type][$action]['aclaccess']);
     }
     return false;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:26,代码来源:ACLAction.php


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