當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。