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


PHP UserManagerInterface::updateUser方法代码示例

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


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

示例1: create

 /**
  * Creates a user and returns it.
  *
  * @param string $username
  * @param string $password
  * @param string $email
  * @param bool   $active
  * @param bool   $superadmin
  *
  * @return \FOS\UserBundle\Model\UserInterface
  */
 public function create($username, $password, $email, $active, $superadmin)
 {
     $discriminator = $this->discriminator;
     switch ($this->type) {
         case 'staff':
             $class = 'Truckee\\MatchBundle\\Entity\\Staff';
             break;
         case 'admin':
             $class = 'Truckee\\MatchBundle\\Entity\\Admin';
             break;
         case 'volunteer':
             $class = 'Truckee\\MatchBundle\\Entity\\Volunteer';
             break;
         default:
             break;
     }
     $discriminator->setClass($class);
     $user = $this->userManager->createUser();
     $user->setUsername($username);
     $user->setFirstname($this->firstname);
     $user->setLastname($this->lastname);
     $user->setEmail($email);
     $user->setPlainPassword($password);
     $user->setEnabled((bool) $active);
     $this->userManager->updateUser($user, true);
     return $user;
 }
开发者ID:truckee,项目名称:match,代码行数:38,代码来源:UserManipulator.php

示例2: onSuccess

 /**
  * @param UserInterface $user
  */
 protected function onSuccess(UserInterface $user)
 {
     if ($this->getNewPassword() != "") {
         $user->setPlainPassword($this->getNewPassword());
     }
     $this->userManager->updateUser($user);
 }
开发者ID:Tagarela76,项目名称:table4you,代码行数:10,代码来源:ProfileFormHandler.php

示例3: updateObject

 /**
  * Updates the given user object.
  *
  * @param DataEvent $event
  */
 public function updateObject(DataEvent $event)
 {
     $object = $event->getData();
     if ($object instanceof UserInterface) {
         $this->userManager->updateUser($object);
         $this->eventDispatcher->dispatch(Events::POST_UPDATE, $event);
         $event->stopPropagation();
     }
 }
开发者ID:reminec,项目名称:DunglasApiBundle,代码行数:14,代码来源:EventSubscriber.php

示例4: onSecurityInteractiveLogin

 /**
  * handle user Ip log to users table, after login, with security.interactive_login kernel event.
  *
  * @param InteractiveLoginEvent $event
  */
 public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
 {
     $user = $event->getAuthenticationToken()->getUser();
     if ($user instanceof UserInterface) {
         $ipAddress = $this->requestStack->getCurrentRequest()->server->get('REMOTE_ADDR');
         $user->setLastloginClientIp($ipAddress);
         $this->userManager->updateUser($user);
     }
 }
开发者ID:extdevelopment,项目名称:login-task,代码行数:14,代码来源:InteractiveLoginListener.php

示例5: createUserFromResponse

 /**
  * Create user from response
  *
  * @param UserResponseInterface $response
  *
  * @return User
  */
 private function createUserFromResponse(UserResponseInterface $response)
 {
     /** @var User $user User */
     $user = $this->userManager->createUser();
     $user->setUsername($response->getUsername())->setFullName($response->getRealName())->setEmail($response->getEmail())->setEnabled(true)->setPlainPassword(uniqid())->setFacebookId($response->getUsername())->setFacebookAccessToken($response->getAccessToken());
     $this->eventDispatcher->dispatch(AppEvents::FACEBOOK_USER_CONNECTED, new FacebookUserConnectedEvent($user));
     $this->userManager->updateUser($user);
     return $user;
 }
开发者ID:stfalcon-studio,项目名称:lost-and-found,代码行数:16,代码来源:AuthProvider.php

示例6: closeAccount

 public function closeAccount(Response $response)
 {
     $user = $this->securityContext->getToken()->getUser();
     $user->setEnabled(false);
     $this->userManager->updateUser($user);
     $cookieHandler = new CookieClearingLogoutHandler($this->request->cookies->all());
     $cookieHandler->logout($this->request, $response, $this->securityContext->getToken());
     $sessionHandler = new SessionLogoutHandler();
     $sessionHandler->logout($this->request, $response, $this->securityContext->getToken());
     $this->securityContext->setToken(null);
 }
开发者ID:hotfics,项目名称:lichess-old,代码行数:11,代码来源:AccountCloser.php

示例7: create

 /**
  * Creates a user and returns it.
  *
  * @param string $email
  * @param string $password
  * @param string $fullname
  * @param string $institution
  * @param bool   $active
  * @param bool   $superadmin
  *
  * @return User
  */
 public function create($email, $password, $fullname, $institution, $active, $superadmin)
 {
     $user = $this->userManager->createUser();
     $user->setEmail($email);
     $user->setPlainPassword($password);
     $user->setFullname($fullname);
     $user->setInstitution($institution);
     $user->setEnabled($active);
     $user->setSuperAdmin($superadmin);
     $this->userManager->updateUser($user);
     return $user;
 }
开发者ID:ubermichael,项目名称:pkppln-php,代码行数:24,代码来源:UserManipulator.php

示例8: create

 /**
  * Creates a user and returns it.
  *
  * @param string  $username
  * @param string  $password
  * @param string  $email
  * @param Boolean $active
  * @param Boolean $superadmin
  *
  * @return \FOS\UserBundle\Model\UserInterface
  */
 public function create($username, $password, $email, $active, $superadmin)
 {
     $user = $this->userManager->createUser();
     $user->setUsername($username);
     $user->setName($this->name);
     $user->setSurname($this->surname);
     $user->setEmail($email);
     $user->setPlainPassword($password);
     $user->setEnabled((bool) $active);
     $this->userManager->updateUser($user, true);
     return $user;
 }
开发者ID:kawashita86,项目名称:gpanel,代码行数:23,代码来源:UserManipulator.php

示例9: loadUserByOAuthUserResponse

 /**
  * {@inheritDoc}
  */
 public function loadUserByOAuthUserResponse(UserResponseInterface $response)
 {
     $username = $response->getUsername();
     $user = $this->userManager->findUserBy(array('githubId' => $username));
     if (!$user) {
         throw new AccountNotLinkedException(sprintf('No user with github username "%s" was found.', $username));
     }
     if (!$user->getGithubToken()) {
         $user->setGithubToken($response->getAccessToken());
         $this->userManager->updateUser($user);
     }
     return $user;
 }
开发者ID:enriquesomolinos,项目名称:packagist,代码行数:16,代码来源:UserProvider.php

示例10: onSuccess

 protected function onSuccess()
 {
     if ($this->confirmation) {
         $user->setEnabled(false);
         $this->mailer->sendConfirmationEmailMessage($this->user);
     } else {
         $user->setConfirmationToken(null);
         $user->setEnabled(true);
     }
     $user->setRoles(array('ROLE_ADMIN'));
     $user->setPermissions(array('VIEW', 'EDIT', 'CREATE', 'DELETE'));
     $this->userManager->updateUser($this->user, true);
 }
开发者ID:pigroupe,项目名称:SfynxAuthBundle,代码行数:13,代码来源:RegistrationFormHandler.php

示例11: create

 /**
  * Creates a user and returns it.
  *
  * @param string  $username
  * @param string  $password
  * @param string  $email
  * @param Boolean $active
  * @param Boolean $superadmin
  * @param string  $firstName
  * @param string  $lastName
  * @param integer  $phoneNumber
  *
  * @return \AppBundle\Entity\Users
  */
 public function create($username, $password, $email, $active, $superadmin, $firstName, $lastName, $phoneNumber)
 {
     $user = new Users();
     $user->setUsername($username);
     $user->setEmail($email);
     $user->setPlainPassword($password);
     $user->setEnabled((bool) $active);
     $user->setFirstName($firstName);
     $user->setLastName($lastName);
     $user->setPhoneNumber($phoneNumber);
     $user->setSuperAdmin((bool) $superadmin);
     $this->userManager->updateUser($user);
     return $user;
 }
开发者ID:Kit-kat1,项目名称:symfony-app,代码行数:28,代码来源:UserManipulator.php

示例12: connect

 /**
  * {@inheritDoc}
  */
 public function connect($user, UserResponseInterface $response)
 {
     $property = $this->getProperty($response);
     $setter = 'set' . ucfirst($property);
     if (!method_exists($user, $setter)) {
         throw new \RuntimeException(sprintf("Class '%s' should have a method '%s'.", get_class($user), $setter));
     }
     $username = $response->getUsername();
     if (null !== ($previousUser = $this->userManager->findUserBy(array($property => $username)))) {
         $previousUser->{$setter}(null);
         $this->userManager->updateUser($previousUser);
     }
     $user->{$setter}($username);
     $this->userManager->updateUser($user);
 }
开发者ID:rafalwrzeszcz,项目名称:HWIOAuthBundle,代码行数:18,代码来源:FOSUBUserProvider.php

示例13: unlock

 public function unlock(User $user, $username, $password)
 {
     $user->setUsername($username);
     $user->setPlainPassword($password);
     $user->setUnlockToken(null);
     $errors = $this->validator->validate($user, ['Registration']);
     if ($errors->count() === 0) {
         try {
             $this->userManager->updateUser($user);
         } catch (\Exception $e) {
             throw new Exception($e->getMessage());
         }
         return true;
     }
     return $errors;
 }
开发者ID:rogoit,项目名称:angsym,代码行数:16,代码来源:RegistrationHandler.php

示例14: create

 /**
  * Creates a user and returns it.
  *
  * @param string $username
  * @param string $password
  * @param string $email
  * @param string $name
  * @param string $lastName
  * @param bool   $active
  * @param bool   $superadmin
  *
  * @return \FOS\UserBundle\Model\UserInterface
  */
 public function create($username, $password, $email, $name, $lastName, $active, $superadmin, $changePassword)
 {
     $user = $this->userManager->createUser();
     $user->setUsername($username);
     $user->setEmail($email);
     $user->setPlainPassword($password);
     $user->setName($name);
     $user->setLastName($lastName);
     $user->setEnabled((bool) $active);
     $user->setSuperAdmin((bool) $superadmin);
     if ((bool) $changePassword) {
         $user->setPasswordExpireAt(new \DateTime());
     }
     $this->userManager->updateUser($user);
     return $user;
 }
开发者ID:tkuska,项目名称:user,代码行数:29,代码来源:UserManipulator.php

示例15: onKernelView

 /**
  * Persists, updates or delete data return by the controller if applicable.
  *
  * @param GetResponseForControllerResultEvent $event
  */
 public function onKernelView(GetResponseForControllerResultEvent $event)
 {
     $user = $event->getControllerResult();
     if (!$user instanceof UserInterface) {
         return;
     }
     switch ($event->getRequest()->getMethod()) {
         case Request::METHOD_POST:
         case Request::METHOD_PUT:
             $this->userManager->updateUser($user, false);
             break;
         case Request::METHOD_DELETE:
             $this->userManager->deleteUser($user);
             $event->setControllerResult(null);
             break;
     }
 }
开发者ID:ZeBigDuck,项目名称:DunglasApiBundle,代码行数:22,代码来源:EventListener.php


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