本文整理汇总了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();
}
示例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);
}
示例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());
}
示例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);
}
示例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();
}
示例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;
}
示例7: getUserKey
private function getUserKey(User $user)
{
if ($user === null) {
return 'anonymous';
} else {
return $user->getId();
}
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}