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


PHP AuthenticationService::getUser方法代码示例

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


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

示例1: createQuery

 /**
  * for people
  * following parameter are relevant
  * by     => 'all', 'me', 'guest'
  * status => Status::CREATED, 'all'
  * user   => User::ROLE_RECRUITER, User::ROLE_ADMIN, User::ROLE_USER
  *
  * @param $params
  * @param $queryBuilder
  * @return mixed
  */
 public function createQuery($params, $queryBuilder)
 {
     $this->value = $params->toArray();
     $this->user = $this->auth->getUser();
     $isRecruiter = $this->user->getRole() == User::ROLE_RECRUITER || $this->acl->inheritsRole($this->user, User::ROLE_RECRUITER);
     if ($isRecruiter && (!isset($this->value['by']) || $this->value['by'] != 'guest')) {
         /*
          * a recruiter can see his jobs and jobs from users who gave permissions to do so
          */
         if (isset($this->value['params']['by']) && 'me' == $this->value['params']['by']) {
             $queryBuilder->field('user')->equals($this->user->id);
         } else {
             $queryBuilder->field('permissions.view')->equals($this->user->id);
         }
         if (isset($this->value['params']['status']) && !empty($this->value['params']['status']) && $this->value['params']['status'] != 'all') {
             $queryBuilder->field('status.name')->equals((string) $this->value['params']['status']);
         }
     } else {
         /*
          * an applicants or guests can see all active jobs
          */
         $queryBuilder->field('status.name')->equals(Status::ACTIVE);
     }
     /*
      * search jobs by keywords
      */
     if (isset($this->value['params']['search']) && !empty($this->value['params']['search'])) {
         $search = strtolower($this->value['params']['search']);
         $searchPatterns = array();
         foreach (explode(' ', $search) as $searchItem) {
             $searchPatterns[] = new \MongoRegex('/^' . $searchItem . '/');
         }
         $queryBuilder->field('keywords')->all($searchPatterns);
     }
     if (isset($this->value['location'])) {
         $loc = $this->value['location'];
         $queryBuilder->field('locations.coordinates')->near($loc->getCoordinates())->maxDistance($this->value['d'] * 1000);
     }
     if (isset($this->value['sort'])) {
         foreach (explode(",", $this->value['sort']) as $sort) {
             $queryBuilder->sort($this->filterSort($sort));
         }
     }
     return $queryBuilder;
 }
开发者ID:webpants,项目名称:YAWIK,代码行数:56,代码来源:PaginationQuery.php

示例2: createQuery

 /**
  * for people
  * following parameter are relevant
  * by     => 'all', 'me', 'guest'
  * status => Status::CREATED, 'all'
  * user   => User::ROLE_RECRUITER, User::ROLE_ADMIN, User::ROLE_USER
  *
  * @param $params Parameters
  * @param $queryBuilder \Doctrine\ODM\MongoDB\Query\Builder
  * @return mixed
  */
 public function createQuery($params, $queryBuilder)
 {
     $this->value = $params;
     /*
      * search jobs by keywords
      */
     if (isset($params['search']) && !empty($params['search'])) {
         $search = strtolower($params['search']);
         $expression = $queryBuilder->expr()->operator('$text', ['$search' => $search]);
         $queryBuilder->field(null)->equals($expression->getQuery());
     }
     if (isset($this->value['location']->coordinates)) {
         $coordinates = $this->value['location']->coordinates->getCoordinates();
         $queryBuilder->field('locations.coordinates')->geoWithinCenter($coordinates[0], $coordinates[1], (double) $this->value['d'] / 100);
     }
     if (isset($params['channel']) && !empty($params['channel']) && $params['channel'] != "default") {
         $queryBuilder->field('portals')->equals($params['channel']);
     }
     $this->user = $this->auth->getUser();
     $isRecruiter = $this->user->getRole() == User::ROLE_RECRUITER || $this->acl->inheritsRole($this->user, User::ROLE_RECRUITER);
     if ($isRecruiter && (!isset($this->value['by']) || $this->value['by'] != 'guest')) {
         /*
          * a recruiter can see his jobs and jobs from users who gave permissions to do so
          */
         if (isset($params['by']) && 'me' == $params['by']) {
             $queryBuilder->field('user')->equals($this->user->id);
         } else {
             $queryBuilder->field('permissions.view')->equals($this->user->id);
         }
         if (isset($params['status']) && !empty($params['status']) && $params['status'] != 'all') {
             $queryBuilder->field('status.name')->equals((string) $params['status']);
         }
     } else {
         /*
          * an applicants or guests can see all active jobs
          */
         $queryBuilder->field('status.name')->equals(Status::ACTIVE);
     }
     if (isset($this->value['sort'])) {
         foreach (explode(",", $this->value['sort']) as $sort) {
             $queryBuilder->sort($this->filterSort($sort));
         }
     }
     return $queryBuilder;
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:56,代码来源:PaginationQuery.php


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