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


PHP Profile_User::haveUniqueRight方法代码示例

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


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

示例1: prepareInputDataForProcess

 /**
  * @see RuleCollection::prepareInputDataForProcess()
  **/
 function prepareInputDataForProcess($input, $params)
 {
     $input['mailcollector'] = $params['mailcollector'];
     $input['_users_id_requester'] = $params['_users_id_requester'];
     $fields = $this->getFieldsToLookFor();
     //Add needed ticket datas for rules processing
     if (isset($params['ticket']) && is_array($params['ticket'])) {
         foreach ($params['ticket'] as $key => $value) {
             if (in_array($key, $fields) && !isset($input[$key])) {
                 $input[$key] = $value;
             }
         }
     }
     //Add needed headers for rules processing
     if (isset($params['headers']) && is_array($params['headers'])) {
         foreach ($params['headers'] as $key => $value) {
             if (in_array($key, $fields) && !isset($input[$key])) {
                 $input[$key] = $value;
             }
         }
     }
     //Add all user's groups
     if (in_array('groups', $fields)) {
         foreach (Group_User::getUserGroups($input['_users_id_requester']) as $group) {
             $input['GROUPS'][] = $group['id'];
         }
     }
     //Add all user's profiles
     if (in_array('profiles', $fields)) {
         foreach (Profile_User::getForUser($input['_users_id_requester']) as $profile) {
             $input['PROFILES'][$profile['profiles_id']] = $profile['profiles_id'];
         }
     }
     //If the criteria is "user has only one time the profile xxx"
     if (in_array('unique_profile', $fields)) {
         //Get all profiles
         $profiles = Profile_User::getForUser($input['_users_id_requester']);
         foreach ($profiles as $profile) {
             if (Profile_User::haveUniqueRight($input['_users_id_requester'], $profile['profiles_id'])) {
                 $input['UNIQUE_PROFILE'][$profile['profiles_id']] = $profile['profiles_id'];
             }
         }
     }
     //Store the number of profiles of which the user belongs to
     if (in_array('one_profile', $fields)) {
         $profiles = Profile_User::getForUser($input['_users_id_requester']);
         if (count($profiles) == 1) {
             $tmp = array_pop($profiles);
             $input['ONE_PROFILE'] = $tmp['profiles_id'];
         }
     }
     //Store the number of profiles of which the user belongs to
     if (in_array('known_domain', $fields)) {
         if (preg_match("/@(.*)/", $input['from'], $results)) {
             if (Entity::getEntityIDByDomain($results[1]) != -1) {
                 $input['KNOWN_DOMAIN'] = 1;
             } else {
                 $input['KNOWN_DOMAIN'] = 0;
             }
         }
     }
     return $input;
 }
开发者ID:stweil,项目名称:glpi,代码行数:66,代码来源:rulemailcollectorcollection.class.php


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