Author: Johannes M. Schmitt (schmittjoh@gmail.com)
Inheritance: implements FOS\UserBundle\Model\UserManagerInterface, implements Symfony\Component\Security\Core\User\UserProviderInterface
コード例 #1
0
ファイル: LoadUserData.php プロジェクト: ABeloeil/lift
 private function adddUser($firstname, $lastname, $email, $password, array $roles, $address, $company = null)
 {
     $user = $this->userManager->createUser();
     $user->setUsername($email);
     $user->setEmail($email);
     $user->setFirstname($firstname);
     $user->setLastname($lastname);
     $user->setPlainPassword($password);
     $user->setRoles($roles);
     $user->setAddress($address);
     $user->setCompany($company ?: null);
     $user->setEnabled(true);
     $this->userManager->updateUser($user, false);
     return $user;
 }
コード例 #2
0
 private function testIfUsernameAlreadyInUse()
 {
     $email = $this->userManager->findUserByUsername($this->submitDatas['email']);
     if ($email) {
         throw new \Exception(json_encode(array("email" => "Cet email est déjà utilisé.")), 403);
     }
 }
コード例 #3
0
ファイル: UserManager.php プロジェクト: Dren-x/mobitnew
 /**
  * Constructor.
  *
  * @param EncoderFactoryInterface $encoderFactory
  * @param CanonicalizerInterface  $usernameCanonicalizer
  * @param CanonicalizerInterface  $emailCanonicalizer
  * @param ObjectManager           $om
  * @param string                  $class
  */
 public function __construct(EncoderFactoryInterface $encoderFactory, CanonicalizerInterface $usernameCanonicalizer, CanonicalizerInterface $emailCanonicalizer, ObjectManager $om, $class)
 {
     parent::__construct($encoderFactory, $usernameCanonicalizer, $emailCanonicalizer);
     $this->objectManager = $om;
     $this->repository = $om->getRepository($class);
     $metadata = $om->getClassMetadata($class);
     $this->class = $metadata->getName();
 }
コード例 #4
0
 /**
  * Constructor.
  *
  * @param EncoderFactoryInterface $encoderFactory
  * @param CanonicalizerInterface  $usernameCanonicalizer
  * @param CanonicalizerInterface  $emailCanonicalizer
  * @param DocumentManager         $dm
  * @param string                  $class
  */
 public function __construct(EncoderFactoryInterface $encoderFactory, CanonicalizerInterface $usernameCanonicalizer, CanonicalizerInterface $emailCanonicalizer, DocumentManager $dm, $class)
 {
     parent::__construct($encoderFactory, $usernameCanonicalizer, $emailCanonicalizer);
     $this->dm = $dm;
     $this->repository = $dm->getRepository($class);
     $metadata = $dm->getClassMetadata($class);
     $this->class = $metadata->name;
 }
コード例 #5
0
 /**
  * Constructor.
  *
  * @param EncoderFactoryInterface $encoderFactory
  * @param string                  $algorithm
  * @param CanonicalizerInterface  $usernameCanonicalizer
  * @param CanonicalizerInterface  $emailCanonicalizer
  * @param EntityManager           $em
  * @param string                  $class
  */
 public function __construct(EncoderFactoryInterface $encoderFactory, $algorithm, CanonicalizerInterface $usernameCanonicalizer, CanonicalizerInterface $emailCanonicalizer, EntityManager $em, $class)
 {
     parent::__construct($encoderFactory, $algorithm, $usernameCanonicalizer, $emailCanonicalizer);
     $this->em = $em;
     $this->repository = $em->getRepository($class);
     $metadata = $em->getClassMetadata($class);
     $this->class = $metadata->name;
 }
コード例 #6
0
 public function __construct(EncoderFactoryInterface $encoderFactory, CanonicalizerInterface $usernameCanonicalizer, CanonicalizerInterface $emailCanonicalizer, Connection $connection, $collection, $class)
 {
     $this->connection = $connection;
     $this->collection = $collection;
     $this->documentHandler = new DocumentHandler($this->connection);
     $this->class = $class;
     parent::__construct($encoderFactory, $usernameCanonicalizer, $emailCanonicalizer);
 }
コード例 #7
0
 /**
  * @param UserManager $userManager
  * @param UserInterface $user
  */
 private function deleteUserIfHeExists($userManager, $user)
 {
     if ($user) {
         $userManager->deleteUser($user);
     }
 }
コード例 #8
0
 /**
  * @param FilterUserResponseEvent $event
  */
 public function onPasswordResettingSuccess(FilterUserResponseEvent $event)
 {
     $user = $event->getUser();
     $user->setPasswordChanged(true);
     $this->userManager->updateUser($user);
 }
コード例 #9
0
 /**
  * Fonction permettant de savoir si un utilisateur existe déja selon son username et email
  * @since 2.3 fourth argument id has ben removed
  * @param UserManager $userManager
  * @param string $username
  * @param string $userMail
  */
 private function userAlreadyExist(UserManager $userManager, $username, $userMail)
 {
     $alreadyExist = false;
     $userByUsername = $userManager->findUserByUsername($username);
     $userByUserMail = $userManager->findUserByEmail($userMail);
     if (isset($userByUsername)) {
         $this->get('session')->getFlashBag()->add('notice', "Le nom d'utilisateur est déjà utilisé.");
         $alreadyExist = true;
     }
     if (isset($userByUserMail)) {
         $this->get('session')->getFlashBag()->add('notice', "L'adresse e-mail est déjà utilisée.");
         $alreadyExist = true;
     }
     return $alreadyExist;
 }
コード例 #10
0
 /**
  * Constructor.
  *
  * @param EncoderFactoryInterface $encoderFactory
  * @param CanonicalizerInterface  $usernameCanonicalizer
  * @param CanonicalizerInterface  $emailCanonicalizer
  * @param string                  $proxyClass
  * @param string                  $modelClass
  */
 public function __construct(EncoderFactoryInterface $encoderFactory, CanonicalizerInterface $usernameCanonicalizer, CanonicalizerInterface $emailCanonicalizer, $proxyClass, $modelClass)
 {
     parent::__construct($encoderFactory, $usernameCanonicalizer, $emailCanonicalizer);
     $this->class = $proxyClass;
     $this->modelClass = $modelClass;
 }
コード例 #11
0
ファイル: UserManager.php プロジェクト: csbill/csbill
 /**
  * Constructor.
  *
  * @param EncoderFactoryInterface $encoderFactory
  * @param CanonicalizerInterface  $usernameCanonicalizer
  * @param CanonicalizerInterface  $emailCanonicalizer
  * @param ObjectManager           $om
  * @param string                  $class
  */
 public function __construct(EncoderFactoryInterface $encoderFactory, CanonicalizerInterface $usernameCanonicalizer, CanonicalizerInterface $emailCanonicalizer, ObjectManager $om, $class)
 {
     parent::__construct($encoderFactory, $usernameCanonicalizer, $emailCanonicalizer);
     $this->objectManager = $om;
     $this->entity = $class;
 }