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


PHP UserInterface::getRoles方法代码示例

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


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

示例1:

 function it_logs_user_in($securityContext, $userChecker, $eventDispatcher, UserInterface $user)
 {
     $user->getRoles()->willReturn(array('ROLE_TEST'));
     $userChecker->checkPreAuth($user)->shouldBeCalled();
     $securityContext->setToken(Argument::type('Symfony\\Component\\Security\\Core\\Authentication\\Token\\UsernamePasswordToken'))->shouldBeCalled();
     $eventDispatcher->dispatch(UserEvents::SECURITY_IMPLICIT_LOGIN, Argument::type('Sylius\\Bundle\\UserBundle\\Event\\UserEvent'))->shouldBeCalled();
     $this->login($user);
 }
开发者ID:Strontium-90,项目名称:Sylius,代码行数:8,代码来源:UserLoginSpec.php

示例2:

 function it_logs_user_in(TokenStorageInterface $tokenStorage, UserCheckerInterface $userChecker, EventDispatcherInterface $eventDispatcher, UserInterface $user)
 {
     $user->getRoles()->willReturn(['ROLE_TEST']);
     $userChecker->checkPreAuth($user)->shouldBeCalled();
     $userChecker->checkPostAuth($user)->shouldBeCalled();
     $tokenStorage->setToken(Argument::type(UsernamePasswordToken::class))->shouldBeCalled();
     $eventDispatcher->dispatch(UserEvents::SECURITY_IMPLICIT_LOGIN, Argument::type(UserEvent::class))->shouldBeCalled();
     $this->login($user);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:9,代码来源:UserLoginSpec.php

示例3:

 function it_logs_user_in($securityContext, $userChecker, $eventDispatcher, UserInterface $user)
 {
     $user->getRoles()->willReturn(array('ROLE_TEST'));
     $userChecker->checkPreAuth($user)->shouldBeCalled();
     $userChecker->checkPostAuth($user)->shouldBeCalled();
     $securityContext->setToken(Argument::type(UsernamePasswordToken::class))->shouldBeCalled();
     $eventDispatcher->dispatch(UserEvents::SECURITY_IMPLICIT_LOGIN, Argument::type(UserEvent::class))->shouldBeCalled();
     $this->login($user);
 }
开发者ID:Silwereth,项目名称:Sylius,代码行数:9,代码来源:UserLoginSpec.php

示例4: array

 function it_does_not_log_user_in_if_user_was_not_found($userRepository, $session, UserInterface $user, Session $minkSession)
 {
     $userRoles = ['ROLE_USER'];
     $userRepository->findOneBy(array('username' => 'sylius@example.com'))->willReturn(null);
     $user->getRoles()->willReturn($userRoles);
     $user->getPassword()->willReturn('xyz');
     $user->serialize()->willReturn('serialized_user');
     $session->set('_security_user', Argument::any())->shouldNotBeCalled();
     $session->save()->shouldNotBeCalled();
     $session->getName()->willReturn('MOCKEDSID');
     $session->getId()->willReturn('xyzc123');
     $minkSession->setCookie('MOCKEDSID', 'xyzc123')->shouldNotBeCalled();
     $this->shouldThrow(new \InvalidArgumentException(sprintf('There is no user with email sylius@example.com')))->during('logIn', array('sylius@example.com', 'default', $minkSession));
 }
开发者ID:Spomky,项目名称:Sylius,代码行数:14,代码来源:SecurityServiceSpec.php

示例5: createToken

 /**
  * @param UserInterface $user
  * @param string        $firewallName
  *
  * @return UsernamePasswordToken
  */
 protected function createToken(UserInterface $user, $firewallName)
 {
     return new UsernamePasswordToken($user, null, $firewallName, $user->getRoles());
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:UserLogin.php

示例6: logIn

 /**
  * {@inheritdoc}
  */
 public function logIn(UserInterface $user)
 {
     $token = new UsernamePasswordToken($user, $user->getPassword(), 'randomstringbutnotnull', $user->getRoles());
     $this->setToken($token);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:8,代码来源:SecurityService.php

示例7: logUserIn

 /**
  * @param UserInterface $user
  */
 private function logUserIn(UserInterface $user)
 {
     $token = new UsernamePasswordToken($user, $user->getPassword(), 'randomstringbutnotnull', $user->getRoles());
     $serializedToken = serialize($token);
     $this->setSerializedToken($serializedToken);
     $this->cookieSetter->setCookie($this->session->getName(), $this->session->getId());
 }
开发者ID:TeamNovatek,项目名称:Sylius,代码行数:10,代码来源:SecurityService.php


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