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


PHP UserInterface::getUsername方法代码示例

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


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

示例1: getAuthorName

 public function getAuthorName()
 {
     if (null === $this->author) {
         return $this->author_name;
     }
     return $this->author->getUsername();
 }
开发者ID:bamper,项目名称:symfony2pros.com,代码行数:7,代码来源:Tutorial.php

示例2: configureOptions

 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefaults(['data_class' => RequestRememberPasswordCommand::class, 'empty_data' => function (FormInterface $form) {
         $email = null === $this->currentUser ? $form->get('email')->getData() : $this->currentUser->getUsername();
         return new RequestRememberPasswordCommand($email);
     }]);
 }
开发者ID:BenGorUser,项目名称:UserBundle,代码行数:10,代码来源:RequestRememberPasswordType.php

示例3: bind

 /**
  * {@inheritDoc}
  *
  * @uses connect()
  *
  * @throws LdapDriverException
  */
 public function bind(UserInterface $user, $password)
 {
     if ($user instanceof LdapUserInterface && $user->getDn()) {
         $bind_rdn = $user->getDn();
     } elseif (isset($this->params['bindRequiresDn']) && $this->params['bindRequiresDn']) {
         if (!isset($this->params['baseDn']) || !isset($this->params['accountFilterFormat'])) {
             throw new LdapDriverException('Param baseDn and accountFilterFormat is required if bindRequiresDn is true');
         }
         $bind_rdn = $this->search($this->params['baseDn'], sprintf($this->params['accountFilterFormat'], $user->getUsername()));
         if (1 == $bind_rdn['count']) {
             $bind_rdn = $bind_rdn[0]['dn'];
         } else {
             return false;
         }
     } else {
         $bind_rdn = $user->getUsername();
     }
     if (null === $this->ldap_res) {
         $this->connect();
     }
     $this->logDebug(sprintf('ldap_bind(%s, ****)', $bind_rdn));
     ErrorHandler::start(E_WARNING);
     $bind = ldap_bind($this->ldap_res, $bind_rdn, $password);
     ErrorHandler::stop();
     return $bind;
 }
开发者ID:ripnet,项目名称:FR3DLdapBundle,代码行数:33,代码来源:LegacyLdapDriver.php

示例4: createUser

 /**
  * Adds a new User to the provider.
  *
  * @param UserInterface $user A UserInterface instance
  *
  * @throws \LogicException
  */
 public function createUser(UserInterface $user)
 {
     if (isset($this->users[strtolower($user->getUsername())])) {
         throw new \LogicException('Another user with the same username already exists.');
     }
     $this->users[strtolower($user->getUsername())] = $user;
 }
开发者ID:mawaha,项目名称:tracker,代码行数:14,代码来源:InMemoryUserProvider.php

示例5: refreshUser

 /**
  * {@inheritDoc}
  */
 public function refreshUser(UserInterface $user)
 {
     if (null === ($refreshedUser = $this->repository->findOneByUsername($user->getUsername()))) {
         throw new UsernameNotFoundException(sprintf('User with id %s not found', json_encode($user->getId())));
     }
     return $refreshedUser;
 }
开发者ID:tuimedia,项目名称:forum,代码行数:10,代码来源:OnDemandUserProvider.php

示例6: equals

 /**
  * @inheritdoc
  */
 public function equals(UserInterface $user)
 {
     if (!$user instanceof User) {
         return false;
     }
     return $user->getUsername() === $this->username;
 }
开发者ID:phecho,项目名称:gitonomy,代码行数:10,代码来源:User.php

示例7: isEqualTo

 public function isEqualTo(UserInterface $user)
 {
     if (!$user instanceof CorredorUser || $this->password !== $user->getPassword() || $this->salt !== $user->getSalt() || $this->username !== $user->getUsername()) {
         return false;
     }
     return true;
 }
开发者ID:eduardobenito10,项目名称:CorredoresRioja,代码行数:7,代码来源:CorredorUser.php

示例8: isEqualTo

 public function isEqualTo(UserInterface $user)
 {
     if ($this->username == $user->getUsername()) {
         return true;
     }
     return false;
 }
开发者ID:flobbie,项目名称:PasswordSafe,代码行数:7,代码来源:User.php

示例9: refreshUser

 public function refreshUser(UserInterface $user)
 {
     if (!$user instanceof User) {
         throw new UnsupportedUserException("Instances of {get_class({$user})} are not supported");
     }
     return $this->loadUserByUsername($user->getUsername());
 }
开发者ID:vbessonov,项目名称:fsrapi,代码行数:7,代码来源:UserProvider.php

示例10: equals

 public function equals(UserInterface $user)
 {
     if ($user instanceof MagentoUser) {
         return $user->getId() === $user->id;
     }
     return $user->getUsername() === $this->email;
 }
开发者ID:Giant-Peach-Design,项目名称:LiipMagentoBundle,代码行数:7,代码来源:MagentoUser.php

示例11: isEqualTo

 public function isEqualTo(UserInterface $user)
 {
     if (!$user instanceof LdapUser || $user->getUsername() !== $this->username || $user->getEmail() !== $this->email || count(array_diff($user->getRoles(), $this->roles)) > 0 || $user->getDn() !== $this->dn) {
         return false;
     }
     return true;
 }
开发者ID:redventures-oss,项目名称:LdapBundle,代码行数:7,代码来源:LdapUser.php

示例12: equals

 public function equals(UserInterface $account)
 {
     if ($this->getUsername() == $account->getUsername()) {
         return true;
     }
     return false;
 }
开发者ID:laiello,项目名称:mediathequescrum,代码行数:7,代码来源:User.php

示例13: refreshUser

 public function refreshUser(UserInterface $user)
 {
     if ($user instanceof User) {
         return $this->loadUserByUsername($user->getUsername());
     }
     throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user)));
 }
开发者ID:Athorcis,项目名称:athorrent-frontend,代码行数:7,代码来源:UserProvider.php

示例14: refreshUser

 /**
  * Refresh the User object
  * @param UserInterface $user
  * @return UserInterface
  */
 public function refreshUser(UserInterface $user)
 {
     try {
         return $this->loadUserByUsername($user->getUsername());
     } catch (UsernameNotFoundException $e) {
         throw new UnsupportedUserException(sprintf('User "%s" did not come from this provider (%s).', $user->getUsername(), get_called_class()));
     }
 }
开发者ID:mlukman,项目名称:securilex-doctrine,代码行数:13,代码来源:DoctrineUserProvider.php

示例15: processRecord

 /**
  * @param array $record
  *
  * @return array
  */
 public function processRecord(array $record)
 {
     if (is_null($this->user)) {
         /* @var TokenStorageInterface $securityTokenStorage */
         $securityTokenStorage = $this->container->get('security.token_storage');
         if ($securityTokenStorage !== null && $securityTokenStorage->getToken() !== null && $securityTokenStorage->getToken()->getUser() instanceof \Symfony\Component\Security\Core\User\AdvancedUserInterface) {
             $this->user = $securityTokenStorage->getToken()->getUser();
             $this->record['extra']['user']['username'] = $this->user->getUsername();
             $this->record['extra']['user']['roles'] = $this->user->getRoles();
             $this->record['extra']['user']['is_account_non_expired'] = $this->user->isAccountNonExpired();
             $this->record['extra']['user']['is_account_non_locked'] = $this->user->isAccountNonLocked();
             $this->record['extra']['user']['is_credentials_non_expired'] = $this->user->isCredentialsNonExpired();
             $this->record['extra']['user']['is_enabled'] = $this->user->isEnabled();
         }
     }
     return array_merge($record, $this->record);
 }
开发者ID:BranchBit,项目名称:KunstmaanBundlesCMS,代码行数:22,代码来源:UserProcessor.php


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