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


PHP Model\UserInterface类代码示例

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


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

示例1: updatePassword

 /**
  * {@inheritDoc}
  */
 public function updatePassword(UserInterface $user)
 {
     if (0 !== strlen($password = $user->getPlainPassword())) {
         $user->setPassword($this->userPasswordEncoder->encode($user));
         $user->eraseCredentials();
     }
 }
开发者ID:nanyi,项目名称:Sylius,代码行数:10,代码来源:PasswordUpdater.php

示例2: login

 /**
  * {@inheritDoc}
  */
 public function login(UserInterface $user, $firewallName = 'main')
 {
     if (!$user->isEnabled()) {
         return;
     }
     parent::login($user, $firewallName);
 }
开发者ID:liverbool,项目名称:dos-user-bundle,代码行数:10,代码来源:UserLogin.php

示例3:

    function it_should_connect_oauth_account_with_given_user(
        $userManager,
        $oauthRepository,
        UserInterface $user,
        UserResponseInterface $response,
        ResourceOwnerInterface $resourceOwner,
        UserOAuthInterface $oauth
    ) {
        $resourceOwner->getName()->willReturn('google');

        $response->getEmail()->willReturn(null);
        $response->getUsername()->willReturn('username');
        $response->getResourceOwner()->willReturn($resourceOwner);
        $response->getAccessToken()->willReturn('access_token');

        $oauthRepository->createNew()->willReturn($oauth);

        $oauth->setIdentifier('username');
        $oauth->setProvider('google');
        $oauth->setAccessToken('access_token');

        $user->addOAuthAccount($oauth)->shouldBeCalled();

        $userManager->persist($user)->shouldBeCalled();
        $userManager->flush()->shouldBeCalled();

        $this->connect($user, $response);
    }
开发者ID:kriswillis,项目名称:Sylius,代码行数:28,代码来源:UserProviderSpec.php

示例4:

 function it_does_nothing_if_plain_password_is_empty(UserPasswordEncoderInterface $userPasswordEncoder, UserInterface $user)
 {
     $user->getPlainPassword()->willReturn('');
     $userPasswordEncoder->encode($user)->willReturn('topSecretEncodedPassword');
     $user->setPassword(Argument::any())->shouldNotBeCalled();
     $user->eraseCredentials()->shouldNotBeCalled();
     $this->updatePassword($user);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:8,代码来源:PasswordUpdaterSpec.php

示例5:

 function it_encodes_password(EncoderFactoryInterface $encoderFactory, PasswordEncoderInterface $passwordEncoder, UserInterface $user)
 {
     $user->getPlainPassword()->willReturn('topSecretPlainPassword');
     $user->getSalt()->willReturn('typicalSalt');
     $encoderFactory->getEncoder($user)->willReturn($passwordEncoder);
     $passwordEncoder->encodePassword('topSecretPlainPassword', 'typicalSalt')->willReturn('topSecretEncodedPassword');
     $this->encode($user)->shouldReturn('topSecretEncodedPassword');
 }
开发者ID:nanyi,项目名称:Sylius,代码行数:8,代码来源:UserPasswordEncoderSpec.php

示例6: updatePassword

 /**
  * {@inheritDoc}
  */
 public function updatePassword(UserInterface $user)
 {
     if (0 !== strlen($password = $user->getPlainPassword())) {
         $encoder = $this->encoderFactory->getEncoder($user);
         $user->setPassword($encoder->encodePassword($password, $user->getSalt()));
         $user->eraseCredentials();
     }
 }
开发者ID:Strontium-90,项目名称:Sylius,代码行数:11,代码来源:PasswordUpdater.php

示例7:

 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

示例8:

 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

示例9:

 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

示例10: it_does_nothing_if_plain_password_is_empty

 public function it_does_nothing_if_plain_password_is_empty($encoderFactory, PasswordEncoderInterface $encoder, UserInterface $user)
 {
     $user->getPlainPassword()->willReturn('');
     $user->getSalt()->willReturn('typicalSalt');
     $encoderFactory->getEncoder($user)->shouldNotBeCalled();
     $encoder->encodePassword('', 'typicalSalt')->shouldNotBeCalled();
     $user->setPassword(Argument::any())->shouldNotBeCalled();
     $user->eraseCredentials()->shouldNotBeCalled();
     $this->updatePassword($user);
 }
开发者ID:Strontium-90,项目名称:Sylius,代码行数:10,代码来源:PasswordUpdaterSpec.php

示例11: blame

 /**
  * @param UserInterface $user
  */
 private function blame(UserInterface $user)
 {
     $cart = $this->getCart();
     if (null === $cart) {
         return;
     }
     $cart->setCustomer($user->getCustomer());
     $this->cartManager->persist($cart);
     $this->cartManager->flush();
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:13,代码来源:CartBlamerListener.php

示例12:

 function it_does_not_allow_to_delete_currently_logged_user(GenericEvent $event, UserInterface $userToBeDeleted, UserInterface $currentlyLoggedInUser, $tokenStorage, $flashBag, TokenInterface $token)
 {
     $event->getSubject()->willReturn($userToBeDeleted);
     $userToBeDeleted->getId()->willReturn(1);
     $tokenStorage->getToken()->willReturn($token);
     $currentlyLoggedInUser->getId()->willReturn(1);
     $token->getUser()->willReturn($currentlyLoggedInUser);
     $event->stopPropagation()->shouldBeCalled();
     $flashBag->add('error', 'Cannot remove currently logged in user.')->shouldBeCalled();
     $this->deleteUser($event);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:11,代码来源:UserDeleteListenerSpec.php

示例13: 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

示例14:

 function it_does_not_update_username_when_customer_email_is_the_same(OnFlushEventArgs $onFlushEventArgs, EntityManager $entityManager, UnitOfWork $unitOfWork, CustomerInterface $customer, UserInterface $user, ClassMetadata $userMetadata)
 {
     $onFlushEventArgs->getEntityManager()->willReturn($entityManager);
     $entityManager->getUnitOfWork()->willReturn($unitOfWork);
     $unitOfWork->getScheduledEntityInsertions()->willReturn([]);
     $unitOfWork->getScheduledEntityUpdates()->willReturn([$customer]);
     $user->getUsername()->willReturn('customer@email.com');
     $customer->getUser()->willReturn($user);
     $customer->getEmail()->willReturn('customer@email.com');
     $user->setUsername('customer@email.com')->shouldNotBeCalled();
     $entityManager->persist($user)->shouldNotBeCalled();
     $unitOfWork->recomputeSingleEntityChangeSet($userMetadata, $user)->shouldNotBeCalled();
     $this->onFlush($onFlushEventArgs);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:14,代码来源:DefaultUsernameORMListenerSpec.php

示例15: executeRoleCommand

 /**
  * {@inheritdoc}
  */
 protected function executeRoleCommand(OutputInterface $output, UserInterface $user, array $securityRoles)
 {
     $error = false;
     foreach ($securityRoles as $securityRole) {
         if (!$user->hasRole($securityRole)) {
             $output->writeln(sprintf('<error>User "%s" didn\'t have "%s" Security role.</error>', (string) $user, $securityRole));
             $error = true;
             continue;
         }
         $user->removeRole($securityRole);
         $output->writeln(sprintf('Security role <comment>%s</comment> has been removed from user <comment>%s</comment>', $securityRole, (string) $user));
     }
     if (!$error) {
         $this->getEntityManager()->flush();
     }
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:19,代码来源:DemoteUserCommand.php


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