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


PHP User::setEnabled方法代码示例

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


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

示例1: load

 public function load(ObjectManager $manager)
 {
     /** @var EncoderFactoryInterface */
     $factory = $this->container->get('security.encoder_factory');
     $john = new User();
     $john->setUsername('john');
     $john->setEmail('john@spotizer.com');
     $john->setRoles(array('ROLE_USER'));
     $john->setEnabled(true);
     $encoder = $factory->getEncoder($john);
     $password = $encoder->encodePassword('john', $john->getSalt());
     $john->setPassword($password);
     $john->setApiToken('abcdefgh');
     $manager->persist($john);
     $sofia = new User();
     $sofia->setUsername('sofia');
     $sofia->setEmail('sofia@spotizer.com');
     $sofia->setRoles(array('ROLE_USER'));
     $sofia->setEnabled(true);
     $encoder = $factory->getEncoder($sofia);
     $password = $encoder->encodePassword('sofia', $sofia->getSalt());
     $sofia->setPassword($password);
     $sofia->setApiToken('1234567');
     $manager->persist($sofia);
     $manager->flush();
 }
开发者ID:FlorianLB,项目名称:formation-sf-dec15,代码行数:26,代码来源:LoadUser.php

示例2: load

 public function load(ObjectManager $manager)
 {
     $passwordEncoder = $this->container->get('security.password_encoder');
     $user_user = new User();
     $user_user->setUsername('user_user');
     $user_user->setEmail('user_user@blog.com');
     $user_user->setRoles(array('ROLE_USER'));
     $user_user->setEnabled(true);
     $encodedPassword = $passwordEncoder->encodePassword($user_user, 'qweasz');
     $user_user->setPassword($encodedPassword);
     $manager->persist($user_user);
     $user_admin = new User();
     $user_admin->setUsername('user_admin');
     $user_admin->setEmail('user_admin@blog.com');
     $user_admin->setRoles(array('ROLE_ADMIN'));
     $user_admin->setEnabled(true);
     $encodedPassword = $passwordEncoder->encodePassword($user_admin, 'qweasz');
     $user_admin->setPassword($encodedPassword);
     $manager->persist($user_admin);
     $user_moderator = new User();
     $user_moderator->setUsername('user_moderator');
     $user_moderator->setEmail('user_moderator@blog.com');
     $user_moderator->setRoles(array('ROLE_MODERATOR'));
     $user_moderator->setEnabled(true);
     $encodedPassword = $passwordEncoder->encodePassword($user_moderator, 'qweasz');
     $user_moderator->setPassword($encodedPassword);
     $manager->persist($user_moderator);
     $manager->flush();
 }
开发者ID:syrotchukandrew,项目名称:blog,代码行数:29,代码来源:LoadUserData.php

示例3: loadUserByOAuthUserResponse

 /**
  * {@inheritdoc}
  */
 public function loadUserByOAuthUserResponse(UserResponseInterface $response)
 {
     $userEmail = $response->getEmail();
     $user = $this->userManager->findUserByEmail($userEmail);
     // if null just create new user and set it properties
     if (null === $user) {
         $userData = $response->getResponse();
         $user = new User();
         $user->setUsername($userData['formattedName']);
         $user->setPlainPassword(rand(1000000, 10000000));
         //TODO:find a better option
         //TODO: add location, company name, ..
         $user->setEmail($response->getEmail());
         $user->setEnabled(true);
         $this->userManager->updateUser($user);
         $this->em->flush();
         return $user;
     }
     // else update access token of existing user
     $serviceName = $response->getResourceOwner()->getName();
     $setter = 'set' . ucfirst($serviceName) . 'AccessToken';
     $user->{$setter}($response->getAccessToken());
     //update access token
     return $user;
 }
开发者ID:OpenSkills,项目名称:skillsprofile,代码行数:28,代码来源:MyFOSUBUserProvider.php

示例4: load

 public function load(ObjectManager $manager)
 {
     $encoder = $this->container->get('security.password_encoder');
     $userAdmin = new User();
     $userAdmin->setEmail('paul.mesnilgrente@gmail.com');
     $userAdmin->setEnabled(1);
     $userAdmin->setUsername('Paul Mesnilgrente');
     $password = $encoder->encodePassword($userAdmin, 'lB7Xq9WdOxCz7Xzod1FH');
     $userAdmin->setPassword($password);
     $userAdmin->setRoles(array('ROLE_SUPER_ADMIN'));
     $manager->persist($userAdmin);
     $manager->flush();
     $user1 = new User();
     $user1->setEmail('karol-anne.pelosato@hotmail.fr');
     $user1->setEnabled(1);
     $user1->setUsername('Karol-anne Pelosato');
     $password = $encoder->encodePassword($user1, '2pMJVtuDtwkctwtf3fLQ');
     $user1->setPassword($password);
     $user1->setRoles(array('ROLE_USER'));
     $manager->persist($user1);
     $manager->flush();
     $user2 = new User();
     $user2->setEmail('mesnil.paul@gmail.com');
     $user2->setEnabled(1);
     $user2->setUsername('Fabien Mesnilgrente');
     $password = $encoder->encodePassword($user2, 'lv4Uem4OtFmfSYYDGX');
     $user2->setPassword($password);
     $user2->setRoles(array('ROLE_USER'));
     $manager->persist($user2);
     $manager->flush();
     $this->addReference('user-admin', $userAdmin);
     $this->addReference('user-karo', $user1);
     $this->addReference('user-fabien', $user2);
 }
开发者ID:paul-mesnilgrente,项目名称:paul-mesnilgrente,代码行数:34,代码来源:LoadUserData.php

示例5: createAction

 public function createAction($format)
 {
     try {
         $em = $this->getDoctrine()->getManager();
         $user = new User();
         $params = array();
         $content = $this->get("request")->getContent();
         if (!empty($content)) {
             $params = json_decode($content, true);
             $user->setConfirmationToken($params['confirmationToken']);
             $user->setCredentialsExpireAt($params['credentialsExpireAt']);
             $user->setCredentialsExpired($params['credentialsExpired']);
             $user->setEmail($params['email']);
             $user->setEmailCanonical($params['emailCanonical']);
             $user->setEnabled($params['enabled']);
             $user->setExpired($params['expired']);
             $user->setExpiresAt($params['expiresAt']);
             $user->setLastLogin($params['lastLogin']);
             $user->setLocked($params['locked']);
             $user->setPassword($params['password']);
             $user->setPasswordRequestedAt($params['passwordRequestedAt']);
             $user->setRoles($params['roles']);
             $user->setSalt($params['salt']);
             $user->setUsername($params['username']);
             $user->setUsernameCanonical($params['usernameCanonical']);
         }
         $em->persist($user);
         $em->flush();
         return $this->formatResponse("ok", $format);
     } catch (Exception $ex) {
         return $this->formatResponse("error", $format);
     }
 }
开发者ID:dowrow,项目名称:Symfony-REST,代码行数:33,代码来源:UserController.php

示例6: load

 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $userAdmin = new User();
     $userAdmin->setUsername('ricardo75');
     $userAdmin->setFirstName('richard');
     $userAdmin->setLastName('lawson');
     $userAdmin->setEmail('richard@network90.com');
     $userAdmin->setPlainPassword('aberdeen');
     $userAdmin->setRoles(array('ROLE_SUPER_ADMIN'));
     $userAdmin->setEnabled(true);
     $user = new User();
     $user->setUsername('flipshark');
     $user->setFirstName('mick');
     $user->setLastName('jagger');
     $user->setEmail('lawson_richard@hotmail.com');
     $user->setPlainPassword('aberdeen');
     $user->setRoles(array('ROLE_USER'));
     $user->setEnabled(true);
     $user2 = new User();
     $user2->setUsername('elcondor');
     $user2->setFirstName('keith');
     $user2->setLastName('richards');
     $user2->setEmail('richard@hotmail.com');
     $user2->setPlainPassword('aberdeen');
     $user2->setRoles(array('ROLE_USER'));
     $user2->setEnabled(true);
     $manager->persist($userAdmin);
     $manager->persist($user);
     $manager->persist($user2);
     $manager->flush();
     $this->addReference('user-ricardo75', $userAdmin);
     $this->addReference('user-flipshark', $user);
 }
开发者ID:richardlawson,项目名称:coinflip,代码行数:36,代码来源:LoadUserData.php

示例7: load

 public function load(ObjectManager $manager)
 {
     $passwordEncoder = $this->container->get('security.password_encoder');
     for ($i = 0; $i < 3; $i++) {
         $user_user = new User();
         $user_user->setUsername('user_user' . $i);
         $user_user->setEmail('user_user' . $i . '@rainbow.com');
         $user_user->setRoles(array('ROLE_USER'));
         $user_user->setEnabled(true);
         $encodedPassword = $passwordEncoder->encodePassword($user_user, 'qweasz');
         $user_user->setPassword($encodedPassword);
         $manager->persist($user_user);
         $user_manager = new User();
         $user_manager->setUsername('user_manager' . $i);
         $user_manager->setEmail('user_manager' . $i . '@rainbow.com');
         $user_manager->setRoles(array('ROLE_MANAGER'));
         $user_manager->setEnabled(true);
         $encodedPassword = $passwordEncoder->encodePassword($user_manager, 'qweasz');
         $user_manager->setPassword($encodedPassword);
         $manager->persist($user_manager);
     }
     $user_admin = new User();
     $user_admin->setUsername('user_admin');
     $user_admin->setEmail('qweasz@ukr.net');
     $user_admin->setRoles(array('ROLE_ADMIN'));
     $user_admin->setEnabled(true);
     $encodedPassword = $passwordEncoder->encodePassword($user_admin, 'qweasz');
     $user_admin->setPassword($encodedPassword);
     $manager->persist($user_admin);
     $manager->flush();
 }
开发者ID:syrotchukandrew,项目名称:rainbow,代码行数:31,代码来源:LoadUserData.php

示例8: load

 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $user = new User();
     $user->setUsername('admin');
     $user->setEmail('admin@test.com');
     $user->setPlainPassword('test');
     $user->setEnabled(true);
     $user->setRoles(array('ROLE_ADMIN'));
     $manager->persist($user);
     $manager->flush();
 }
开发者ID:vitor-silva,项目名称:symfony-playground,代码行数:14,代码来源:LoadUserData.php

示例9: load

 public function load(ObjectManager $manager)
 {
     $user = new User();
     $user->setUsername('testuser');
     $user->setPlainPassword('testpass');
     $user->setEmail('test@example.com');
     $user->setEnabled(true);
     $manager->persist($user);
     $manager->flush();
     $this->addReference('test-user', $user);
 }
开发者ID:jasongrimes,项目名称:stressmonkey,代码行数:11,代码来源:LoadUserData.php

示例10: loadUser1

 private function loadUser1(ObjectManager $manager)
 {
     $user = new User();
     $user->setUsername('user1');
     $user->setEmail('user1@gmail.com');
     $user->setPlainPassword('user1_pass');
     $user->setEnabled(true);
     //        $user->addRole(User::ROLE_DEFAULT);
     $manager->persist($user);
     $manager->flush($user);
     $this->addReference('user_user1', $user);
 }
开发者ID:Algatux,项目名称:symfony3.0,代码行数:12,代码来源:LoadUserData.php

示例11: addSuperAdmin

 private function addSuperAdmin(ObjectManager $manager)
 {
     $user = new User();
     $user->setUsername($this->superAdminMail);
     $user->setEmail($this->superAdminMail);
     $user->setSuperAdmin(true);
     $user->setEnabled(true);
     $encoder = $this->container->get('security.encoder_factory')->getEncoder($user);
     $user->setPassword($encoder->encodePassword('secret', $user->getSalt()));
     $manager->persist($user);
     $manager->flush();
 }
开发者ID:Nemrtvej,项目名称:symfony-template,代码行数:12,代码来源:UsersData.php

示例12: load

 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $userAdmin = new User();
     $userAdmin->setUsername('admin');
     $userAdmin->setEmail('admin@admin.lan');
     $userAdmin->setEnabled(true);
     $userAdmin->addRole('ROLE_ADMIN');
     $hash = $this->container->get('security.password_encoder')->encodePassword($userAdmin, 'admin');
     $userAdmin->setPassword($hash);
     $manager->persist($userAdmin);
     $manager->flush();
 }
开发者ID:redssie,项目名称:EP_Trgovina,代码行数:15,代码来源:LoadUserData.php

示例13: load

 /**
  * @param ObjectManager $manager
  *
  * @return $this
  */
 public function load(ObjectManager $manager)
 {
     $admin = new User();
     $admin->setUsername('admin');
     $admin->setEmail('admin@cocoaco.de');
     $admin->setSuperAdmin(true);
     $admin->setEnabled(true);
     $admin->setPlainPassword('admin');
     $manager->persist($admin);
     $manager->flush();
     $this->addReference('admin-user', $admin);
     return $this;
 }
开发者ID:staegi,项目名称:symfony-rest-api,代码行数:18,代码来源:UserData.php

示例14: createUser

 /**
  * @Given there are following users:
  *
  * @param TableNode $tableNode
  */
 public function createUser(TableNode $tableNode)
 {
     $em = $this->getEntityManager();
     foreach ($tableNode->getHash() as $userHash) {
         $user = new User();
         $user->setUsername($userHash['username']);
         $user->setEmail($userHash['email']);
         $user->setPlainPassword($userHash['plainPassword']);
         $user->setEnabled($userHash['enabled']);
         $em->persist($user);
     }
     $em->flush();
 }
开发者ID:aulasoftwarelibre,项目名称:fastconfer,代码行数:18,代码来源:UserContext.php

示例15: load

 public function load(ObjectManager $manager)
 {
     $userPassword = 'siab';
     $user = new User();
     $user->setUsername($userPassword);
     $user->setEmail('admin@mail.com');
     $user->setFullName('super administrator');
     $user->setRoles(array('ROLE_SUPER_ADMIN'));
     $user->setPlainPassword($userPassword);
     $user->setEnabled(true);
     $manager->persist($user);
     $manager->flush();
 }
开发者ID:mrcoco,项目名称:Skeleton,代码行数:13,代码来源:LoadUserData.php


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