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


PHP Entity\User类代码示例

本文整理汇总了PHP中Claroline\CoreBundle\Entity\User的典型用法代码示例。如果您正苦于以下问题:PHP User类的具体用法?PHP User怎么用?PHP User使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: findAncestors

 /**
  * Returns the ancestors of a message (the message itself is also returned).
  *
  * @param Message $message
  *
  * @return array[Message]
  */
 public function findAncestors(Message $message, User $user)
 {
     $dql = "\n            SELECT m\n            FROM Claroline\\MessageBundle\\Entity\\Message m\n            JOIN m.userMessages um\n            JOIN um.user u\n            WHERE m.lft BETWEEN m.lft AND m.rgt\n            AND m.root = {$message->getRoot()}\n            AND m.lvl <= {$message->getLvl()}\n            AND (\n                u.id = :userid\n                OR m.user = :userid\n            )\n        ";
     $query = $this->_em->createQuery($dql);
     $query->setParameter('userid', $user->getId());
     return $query->getResult();
 }
开发者ID:claroline,项目名称:distribution,代码行数:14,代码来源:MessageRepository.php

示例2: registerUserToCursusHierarchy

 public function registerUserToCursusHierarchy($platformName, User $user, $cursusId)
 {
     $targetPlatformUrl = $this->friendRepo->findOneByName($platformName);
     $url = 'clarolinecursusbundle/api/users/' . $user->getId() . '/tos/' . $cursusId . '/cursus/hierarchy/add.json';
     $serverOutput = $this->apiManager->url($targetPlatformUrl, $url);
     return json_decode($serverOutput, true);
 }
开发者ID:claroline,项目名称:distribution,代码行数:7,代码来源:CursusApiManager.php

示例3: regenerateRssUrlAction

 /**
  * @Route("/regenerate_rss", name="icap_notification_regenerate_rss_url")
  * @Template("IcapNotificationBundle:Parameters:config.html.twig")
  * @ParamConverter("user", options={"authenticatedUser" = true})
  */
 public function regenerateRssUrlAction(User $user)
 {
     $parametersManager = $this->getParametersManager();
     $parameters = $parametersManager->regenerateRssId($user->getId());
     $types = $parametersManager->allTypesList($parameters);
     return array('types' => $types, 'rssId' => $parameters->getRssId());
 }
开发者ID:claroline,项目名称:distribution,代码行数:12,代码来源:NotificationUserParametersController.php

示例4: request

 public function request($method, $uri, User $user = null, array $parameters = [])
 {
     if (!$this->client instanceof Client) {
         throw new \Exception('This method requires a client property of type ' . 'Symfony\\Component\\BrowserKit\\Client');
     }
     $server = $user ? ['PHP_AUTH_USER' => $user->getUsername(), 'PHP_AUTH_PW' => $user->getPlainPassword()] : [];
     return $this->client->request($method, $uri, $parameters, [], $server);
 }
开发者ID:claroline,项目名称:distribution,代码行数:8,代码来源:RequestTrait.php

示例5: findByUser

 public function findByUser(User $user, $showAll = false)
 {
     $qb = $this->createQueryBuilder('f')->leftJoin('f.panelFacets', 'pf')->leftJoin('pf.fieldsFacet', 'ff')->leftJoin('ff.fieldsFacetValue', 'ffv');
     if (!$showAll) {
         $qb->join('f.roles', 'frole')->join('pf.panelFacetsRole', 'pfr')->andWhere('frole in (:roles)')->andWhere('pfr.role in (:roles)')->andWhere('pfr.canOpen = true')->setParameter('roles', $user->getEntityRoles());
     }
     return $qb->getQuery()->getResult();
 }
开发者ID:claroline,项目名称:distribution,代码行数:8,代码来源:FacetRepository.php

示例6: findByUserWithAccessToken

 /**
  * @param User $user
  * @param bool $executeQuery
  *
  * @return Query|array
  */
 public function findByUserWithAccessToken(User $user, $executeQuery = true)
 {
     $query = $this->getEntityManager()->createQuery('SELECT c, at
             FROM ClarolineCoreBundle:Oauth\\Client c
             JOIN c.accessTokens at
             WHERE at.user = :userId')->setParameter('userId', $user->getId());
     return $executeQuery ? $query->getResult() : $query;
 }
开发者ID:claroline,项目名称:distribution,代码行数:14,代码来源:ClientRepository.php

示例7: getUserKey

 private function getUserKey(User $user)
 {
     if ($user === null) {
         return 'anonymous';
     } else {
         return $user->getId();
     }
 }
开发者ID:ngodfraind,项目名称:DropZoneBundle,代码行数:8,代码来源:TemporaryAccessResourceManager.php

示例8: findByUser

 /**
  * @param User $user
  * @param bool $getQuery
  *
  * @return Query|array
  */
 public function findByUser(User $user, $getQuery = false)
 {
     $query = $this->getEntityManager()->createQuery('SELECT bc, b, bt
             FROM IcapBadgeBundle:BadgeClaim bc
             JOIN bc.badge b
             JOIN b.translations bt
             WHERE bc.user = :userId')->setParameter('userId', $user->getId());
     return $getQuery ? $query : $query->getResult();
 }
开发者ID:claroline,项目名称:distribution,代码行数:15,代码来源:BadgeClaimRepository.php

示例9: findByUser

 /**
  * @param User $user
  * @param bool $executeQuery
  *
  * @return Query|array
  */
 public function findByUser(User $user, $executeQuery = true)
 {
     $query = $this->getEntityManager()->createQuery('SELECT b, ub, bt
             FROM IcapBadgeBundle:Badge b
             JOIN b.userBadges ub
             JOIN b.translations bt
             WHERE ub.user = :userId')->setParameter('userId', $user->getId());
     return $executeQuery ? $query->getResult() : $query;
 }
开发者ID:claroline,项目名称:distribution,代码行数:15,代码来源:BadgeRepository.php

示例10: findByUser

 /**
  * @param User $user
  * @param bool $executeQuery
  *
  * @return Query|array
  */
 public function findByUser(User $user, $executeQuery = true)
 {
     $query = $this->getEntityManager()->createQuery('SELECT badgeCollection, userBadges
             FROM IcapBadgeBundle:BadgeCollection badgeCollection
             LEFT JOIN badgeCollection.userBadges userBadges
             WHERE badgeCollection.user = :userId
             ORDER BY badgeCollection.name ASC')->setParameter('userId', $user->getId());
     return $executeQuery ? $query->getResult() : $query;
 }
开发者ID:claroline,项目名称:distribution,代码行数:15,代码来源:BadgeCollectionRepository.php

示例11: adminOrNot

 /**
  *  Admin or not
  *
  * @param User $user
  * @return boolean
  */
 public function adminOrNot(User $user)
 {
     $adminInnova = false;
     // TODO : change service to @security.authorization_checker
     if ($this->securityContext->isGranted('ROLE_ADMIN' === true) && $this->get('security.context')->getToken()->getUser()->getId() == $user->getId()) {
         $adminInnova = true;
     }
     return $adminInnova;
 }
开发者ID:arnaudbey,项目名称:CollecticielBundle,代码行数:15,代码来源:CollecticielManager.php

示例12: checkRights

 public function checkRights(User $user, $theRight)
 {
     if ($this->authorization->isGranted('ROLE_ADMIN')) {
         return true;
     }
     $roles = $user->getEntityRoles();
     $rights = $this->rightsRepo->findPresenceRightsByRolesAndValue($roles, $theRight);
     return count($rights) > 0;
 }
开发者ID:claroline,项目名称:distribution,代码行数:9,代码来源:PresenceManager.php

示例13: workspaceUser

 /**
  * @param Workspace $workspace
  * @param User      $user
  *
  * @return User
  */
 public function workspaceUser(Workspace $workspace, User $user)
 {
     $role = new Role();
     $role->setName("ROLE_WS_{$workspace->getName()}_{$user->getUsername()}");
     $role->setTranslationKey($role->getName());
     $role->setWorkspace($workspace);
     $user->addRole($role);
     $this->om->persist($role);
     $this->om->persist($user);
     return $user;
 }
开发者ID:claroline,项目名称:distribution,代码行数:17,代码来源:Persister.php

示例14: persistUser

 protected function persistUser($username)
 {
     $user = new User();
     $user->setFirstName($username);
     $user->setLastName($username);
     $user->setUsername($username);
     $user->setPassword($username);
     $user->setMail($username . '@mail.com');
     $this->om->persist($user);
     return $user;
 }
开发者ID:stefk,项目名称:CompetencyBundle,代码行数:11,代码来源:RepositoryTestCase.php

示例15: __construct

 public function __construct(Cursus $cursus, User $user)
 {
     $details = [];
     $details['username'] = $user->getUsername();
     $details['firsName'] = $user->getFirstName();
     $details['lastName'] = $user->getLastName();
     $details['cursusId'] = $cursus->getId();
     $details['cursusTitle'] = $cursus->getTitle();
     $details['cursusCode'] = $cursus->getCode();
     parent::__construct(self::ACTION, $details, $user);
 }
开发者ID:claroline,项目名称:distribution,代码行数:11,代码来源:LogCursusUserRegistrationEvent.php


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