public function registerAction()
 {
     $request = $this->getRequest();
     $userRegisterForm = new UserRegisterForm();
     if ($request->isPost()) {
         $user = new User();
         $user->setUserLogin($request->getPost('user_login'));
         $user->setUserName($request->getPost('user_name'));
         $user->setUserEmail($request->getPost('user_email'));
         $user->setUserPassword(md5($request->getPost('user_password')));
         $user->setUserIp($_SERVER['REMOTE_ADDR']);
         $user->setUserRegisterDate(new \DateTime('now'));
         $user->setUserProfile(1);
         $userRegisterForm->setInputFilter($user->getInputFilter());
         $userRegisterForm->setData($request->getPost());
         if ($userRegisterForm->isValid()) {
             $this->getEntityManager()->persist($user);
             $this->getEntityManager()->flush();
             $this->flashMessenger()->addInfoMessage("Seu cadastrado foi realizado com sucesso, " . $request->getPost('user_name'));
             return $this->redirect()->toRoute('users-login');
         }
         $this->flashMessenger()->addFlashMessage("Falha no Cadastro.");
         $this->redirect()->toRoute('users-login');
     }
     return new ViewModel(array('userRegisterForm' => $userRegisterForm));
 }
示例#2
0
 public function registerAction()
 {
     $request = $this->getRequest();
     $form = new UserForm();
     $userNameConflict = false;
     if ($request->isPost()) {
         // check if the form is valid
         $form->setData($request->getPost());
         $form->setInputFilter(new UserInputFilter());
         if ($form->isValid()) {
             $data = $form->getData();
             $userRepo = $this->getObjectManager()->getRepository(User::class);
             $userNameConflict = $userRepo->findOneBy(['userName' => $data['username']]) instanceof User;
             if ($userNameConflict) {
                 $form->get('username')->setValue('');
             } else {
                 // if the requested username is not taken yet, create the password and redirect the user to the login
                 $user = new User();
                 $user->setEmail($data['email']);
                 $user->setUserName($data['username']);
                 $bcrypt = new Bcrypt();
                 $password = $bcrypt->create($data['password']);
                 $user->setPassword($password);
                 $this->getObjectManager()->persist($user);
                 $this->getObjectManager()->flush();
                 return $this->redirect()->toRoute('application/user', ['action' => 'login']);
             }
         }
     }
     return new ViewModel(['form' => $form, 'userNameConflict' => $userNameConflict]);
 }
示例#3
0
 public function load(ObjectManager $manager)
 {
     /** @var $user1 \Application\Entity\User */
     $user1 = new User();
     $user1->setUsername('Ila Best')->setEmail('*****@*****.**')->setPassword(rand());
     $manager->persist($user1);
     $user2 = new User();
     $user2->setUsername('Honorato Navarro')->setEmail('*****@*****.**')->setPassword(rand());
     $manager->persist($user2);
     $user3 = new User();
     $user3->setUsername('Reuben Ross')->setEmail('*****@*****.**')->setPassword(rand());
     $manager->persist($user3);
     $user4 = new User();
     $user4->setUsername('Buckminster Patel')->setEmail('*****@*****.**')->setPassword(rand());
     $manager->persist($user4);
     $user5 = new User();
     $user5->setUsername('Kaitlin Pearson')->setEmail('*****@*****.**')->setPassword(rand());
     $manager->persist($user5);
     $user6 = new User();
     $user6->setUsername('Devin Carson')->setEmail('*****@*****.**')->setPassword(rand());
     $manager->persist($user6);
     $user7 = new User();
     $user7->setUsername('Peter James')->setEmail('*****@*****.**')->setPassword(rand());
     $manager->persist($user7);
     $user8 = new User();
     $user8->setUsername('Carol Burgess')->setEmail('*****@*****.**')->setPassword(rand());
     $manager->persist($user8);
     $user9 = new User();
     $user9->setUsername('Walter Mccormick')->setEmail('*****@*****.**')->setPassword(rand());
     $manager->persist($user9);
     $user10 = new User();
     $user10->setUsername('Stuart Grant')->setEmail('*****@*****.**')->setPassword(rand());
     $manager->persist($user10);
     $manager->flush();
 }
示例#4
0
 /**
  * @param User $user
  * @param Group $group
  */
 public function removeUserFromGroup(User $user, Group $group)
 {
     $memberships = $user->getGroupMemberships()->matching(Criteria::create()->where(Criteria::expr()->eq('group', $group)));
     foreach ($memberships as $membership) {
         $this->entityManager->remove($membership);
         $this->entityManager->flush($membership);
     }
 }
示例#5
0
 public function createUser($accountObj, $data)
 {
     $em = $this->getEntityManager();
     $user = new User();
     $user->setAccount($accountObj)->setFirstName($data['first_name'])->setLastName($data['last_name'])->setEmail($data['email'])->setCreateDtTm(new \DateTime())->setUpdateDtTm(new \DateTime());
     $em->persist($user);
     $em->flush();
 }
示例#6
0
 public function load(ObjectManager $manager)
 {
     $user = new User();
     $user->setUsername('testuser');
     $user->setPassword('test123');
     $user->setEmail('*****@*****.**');
     $manager->persist($user);
     $manager->flush();
 }
示例#7
0
 public function removeUser(UserEntity $user)
 {
     foreach ($this->userStorage as $key => $stored) {
         if ($stored === $user) {
             $this->getLogger()->info("Removed user {0}", array($user->getName()));
             unset($this->userStorage[$key]);
             $this->userStorage = array_values($this->userStorage);
         }
     }
 }
示例#8
0
 public function newAction()
 {
     $em = $this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager');
     $game = new Game();
     $currentGame = $game->getCurrentGame($em);
     $user = new User();
     $currentUser = $user->loadUserById($em, 1);
     $this->createCard($em, $currentGame, $currentUser);
     $this->layout('layout/empty');
     echo "OK";
 }
示例#9
0
 public function addAction()
 {
     if ($this->request->isPost()) {
         $user = new User();
         $user->setFullName($this->getRequest()->getPost('fullname'));
         $this->getObjectManager()->persist($user);
         $this->getObjectManager()->flush();
         $newId = $user->getId();
         return $this->redirect()->toRoute('home');
     }
     return new ViewModel();
 }
 /**
  * @param User $user
  * @return User
  */
 public function saveUser(User $user)
 {
     $id = $user->getUserId();
     $data = $user->getArrayCopy();
     if (is_array($user->getImage())) {
         $data['image'] = $user->getImage()['tmp_name'];
     }
     if ($id > 0) {
         $this->update($data, array('userId' => $id));
     } else {
         unset($data['userId']);
         $this->insert($data);
     }
     if (!$user->getUserId()) {
         $user->setUserId($this->getLastInsertValue());
     }
     return $user;
 }
示例#11
0
 public function registerAction()
 {
     $form = new \Application\Form\RegisterForm();
     $request = $this->getRequest();
     $authService = $this->getServiceLocator()->get('Zend\\Authentication\\AuthenticationService');
     $adapter = $authService->getAdapter();
     $data = array();
     $model = new User();
     if ($request->isPost()) {
         $form->setData($request->getPost());
         $model->setEmail($request->getPost()->email);
         $model->setName($request->getPost()->name);
         $model->setRole(User::UserRoleRegisteredUser);
         if (!empty($request->getPost()->password)) {
             $model->setPassword($request->getPost()->password);
         }
         if ($form->isValid()) {
             $this->getObjectManager()->persist($model);
             $this->getObjectManager()->flush();
             //                return $this->redirect()->toUrl('/admin/' . $this->_modelAlias);
         }
     }
     $viewVariables['form'] = $form;
     $viewVariables['model'] = $model;
     //        $this->_view->setVariables($viewVariables);
     return new ViewModel($viewVariables);
 }
示例#12
0
文件: UserForm.php 项目: hopealive/ds
 public function __construct($name = null)
 {
     parent::__construct('user');
     $this->setAttribute('method', 'post');
     $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden')));
     $element = new Element\Email('email');
     $element->setAttributes(array('class' => 'form-control', 'placeholder' => 'email'));
     $this->add($element);
     $element = new Element\Text('name');
     $element->setAttributes(array('class' => 'username', 'size' => '30', 'class' => 'form-control', 'placeholder' => 'name'));
     $this->add($element);
     $element = new Element\Password('password');
     $element->setAttributes(array('class' => 'form-control', 'placeholder' => 'password'));
     $this->add($element);
     $element = new Element\Select('role');
     $element->setAttributes(array('class' => 'form-control ', 'placeholder' => 'role'));
     $element->setValueOptions(User::getRoleNames());
     $this->add($element);
     $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Send', 'id' => 'submitbutton', 'class' => 'form-control btn btn-primary')));
 }
 public function registrationAction()
 {
     $userRegForm = new UserRegistrationForm($this->getEntityManager());
     $userRegForm->getInputFilter()->remove('roles');
     $userRegForm->get('submit')->setValue('Sign Up');
     $userRegForm->setAttribute('action', '/user/registration')->prepare();
     $request = $this->getRequest();
     if (!$request->isPost()) {
         return new ViewModel(array('userRegForm' => $userRegForm));
     }
     $userFormData = $request->getPost();
     $userRegForm->setData($userFormData);
     if (!$userRegForm->isValid()) {
         return new ViewModel(array('userRegForm' => $userRegForm));
     }
     $entityManager = $this->getEntityManager();
     $email = $entityManager->getRepository('Application\\Entity\\User')->findOneByEmail($userFormData['user']['email']);
     if (!empty($email)) {
         $this->flashmessenger()->addMessage('Email already exist.');
         return new ViewModel(array('userRegForm' => $userRegForm, 'messages' => $this->flashmessenger()->getMessages()));
     }
     $userEntity = new UserEntity();
     $userEntity->setEmail($userFormData['user']['email']);
     $userEntity->setPassword($userFormData['user']['password']);
     $userEntity->setCreatedAt();
     $userEntity->setUpdatedAt();
     $userEntity->addRole($entityManager->getRepository('Application\\Entity\\Role')->findOneById($userFormData['roles']['roles']));
     $entityManager->persist($userEntity);
     $entityManager->flush();
     $userProfileEntity = new UserProfileEntity();
     $userProfileEntity->setFirstName($userFormData['profile']['firstname']);
     $userProfileEntity->setLastName($userFormData['profile']['lastname']);
     $userProfileEntity->setPhone($userFormData['profile']['phone']);
     $userProfileEntity->setWebsite($userFormData['profile']['website']);
     $userProfileEntity->setBirthdate(new \DateTime($userFormData['profile']['birthdate']));
     $userProfileEntity->setUser($userEntity);
     $userProfileEntity->setCreatedAt();
     $userProfileEntity->setUpdatedAt();
     $entityManager->persist($userProfileEntity);
     $entityManager->flush();
     $entityManager->clear();
     return new ViewModel(array('userRegForm' => $userRegForm, 'messages' => $this->flashmessenger()->getMessages()));
 }
示例#14
0
 public function editAction()
 {
     $form = new \Admin\Form\UserForm();
     $id = (int) $this->params()->fromRoute('id', 0);
     if ($id > 0) {
         $model = $this->getObjectManager()->find($this->_modelName, $id);
         $form->setData($model->toArray());
         $form->setAttribute('action', '/admin/' . $this->_modelAlias . '/edit/' . $id);
         $form->get('submit')->setAttribute('value', 'Edit');
         $model->setUpdatedDate(new \DateTime());
         $viewVariables['action'] = 'Edit';
     } else {
         $model = new User();
         $form->setAttribute('action', '/admin/' . $this->_modelAlias . '/add');
         $form->get('submit')->setAttribute('value', 'Add');
         $model->setCreatedDate(new \DateTime());
         $viewVariables['action'] = 'Add';
     }
     $request = $this->getRequest();
     if ($request->isPost()) {
         $form->setData($request->getPost());
         $model->setEmail($request->getPost()->email);
         $model->setName($request->getPost()->name);
         $model->setRole($request->getPost()->role);
         if (!empty($request->getPost()->password)) {
             $model->setPassword($request->getPost()->password);
         }
         if ($form->isValid()) {
             $this->getObjectManager()->persist($model);
             $this->getObjectManager()->flush();
             return $this->redirect()->toUrl('/admin/' . $this->_modelAlias);
         }
     }
     $viewVariables['form'] = $form;
     $viewVariables['model'] = $model;
     $this->_view->setTemplate('admin/' . $this->_modelAlias . '/edit');
     $this->_view->setVariables($viewVariables);
     return $this->_view;
 }
示例#15
0
 public function saveUserAction()
 {
     $em = $this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager');
     $data = $this->getRequest()->getPost();
     $user = new User();
     $user->setUsername(strip_tags($data['player_name']));
     $user->setPassword(md5($data['player_password']));
     $user->setMail(strip_tags($data['player_email']));
     $user->setColor(strip_tags($data['player_color']));
     $em->persist($user);
     $em->flush();
     $authService = $this->getServiceLocator()->get('Zend\\Authentication\\AuthenticationService');
     $adapter = $authService->getAdapter();
     $adapter->setIdentityValue(strip_tags($data['player_name']));
     $adapter->setCredentialValue(md5($data['player_password']));
     $authResult = $authService->authenticate();
     if ($authResult->isValid()) {
         return $this->redirect()->toRoute('game');
     }
     return $this->redirect()->toRoute('home');
 }
示例#16
0
 public function addAction()
 {
     $form = new UserForm();
     $request = $this->getRequest();
     $userDAO = UserDAO::getInstance($this->getServiceLocator());
     if ($request->isPost()) {
         $post = $request->getPost()->toArray();
         $form->setData($post);
         if ($form->isValid()) {
             $data = $form->getData();
             $userData = new User();
             $userData->setDisplayName($data['displayName']);
             $userData->setEmail($data['email']);
             $userData->setPassword(md5($data['password']));
             $userData->setRole(RoleDAO::getInstance($this->getServiceLocator())->findOneById($data['role']));
             $userDAO->save($userData);
             return $this->redirect()->toRoute('users');
         } else {
             $form->getMessages();
         }
     }
     return array('form' => $form);
 }
示例#17
0
 /**
  * @param User $user
  * @param Group $group
  * @return bool
  */
 public function isMemberOfGroup(User $user, Group $group)
 {
     return $user->getGroupMemberships()->matching(Criteria::create()->where(Criteria::expr()->eq('group', $group)))->count() > 0;
 }
 /**
  * {@inheritDoc}
  */
 public function getRole()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getRole', array());
     return parent::getRole();
 }
 /**
  * @return \Zend\Http\Response|ViewModel
  */
 public function indexAction()
 {
     if ($this->getAuthService()->hasIdentity()) {
         return $this->redirect()->toRoute('home');
     }
     $helper = new AuthHelper();
     if ($this->sessionCount() == 0) {
         $this->sessionCount(1);
     }
     $hasCaptcha = $this->sessionCount() >= 3;
     if ($hasCaptcha) {
         $plugin = $this->plugin('url');
         $url = $plugin->fromRoute('auth', array('action' => 'captcha'));
         $form = $helper->getForm($hasCaptcha, $url, self::CAPTCHA_DIR);
     } else {
         $form = $helper->getForm($hasCaptcha);
     }
     $request = $this->getRequest();
     $message = "";
     if ($request->isPost()) {
         $form->setInputFilter($helper->getInputFilter());
         $form->setData($request->getPost());
         if ($form->isValid()) {
             $user = $request->getPost('username');
             $pass = $request->getPost('password');
             $authAdapter = $this->getAuthService()->getAdapter();
             $authAdapter->setIdentity($user)->setCredential($pass);
             $result = $authAdapter->authenticate();
             if ($result->isValid()) {
                 if ($request->getPost('remember') == 1) {
                     $this->getSessionStorage()->setRememberMe(1);
                     $this->getAuthService()->setStorage($this->getSessionStorage());
                 }
                 $data = (array) $authAdapter->getResultRowObject();
                 $user = new User();
                 $user->exchangeArray($data);
                 $user->setLastLogin(date('Y-m-d H:i:s'));
                 $this->userTable()->saveUser($user);
                 $columnsToOmit = array('password');
                 $authUser = $authAdapter->getResultRowObject(null, $columnsToOmit);
                 $userRoles = array();
                 foreach ($this->userRoleTable()->grantRoles($authUser->userId) as $userRole) {
                     array_push($userRoles, $userRole->roleId);
                 }
                 $authUser->roles = $userRoles;
                 $this->getAuthService()->getStorage()->write($authUser);
                 $this->sessionCount(-$this->sessionCount());
                 return $this->redirect()->toRoute('home');
             }
             $message = "Invalid user/password";
             $this->sessionCount(1);
         }
     }
     $this->layout('layout/empty');
     return new ViewModel(array('form' => $form, 'message' => $message, 'hasCaptcha' => $hasCaptcha));
 }
 /**
  * Register new User
  * @return array
  */
 public function registerAction()
 {
     $formManager = $this->serviceLocator->get('FormElementManager');
     $form = $formManager->get('registerForm');
     $form->setInputFilter(new Form\RegisterFilter($this->getObjectManager()));
     $request = $this->getRequest();
     if ($request->isPost()) {
         $form->setData($request->getPost());
         if ($form->isValid()) {
             //CREATE NEW USER
             $user = new User();
             $user->setCompany($this->getRequest()->getPost('company'));
             $user->setFirstName($this->getRequest()->getPost('first_name'));
             $user->setLastName($this->getRequest()->getPost('last_name'));
             $user->setEmail($this->getRequest()->getPost('email'));
             $bcrypt = new Bcrypt();
             $securePass = $bcrypt->create($this->getRequest()->getPost('password'));
             $user->setPassword($securePass);
             $user->setStatus(0);
             $token = md5(uniqid(mt_rand(), true));
             $user->setToken($token);
             $user->setAddress("");
             $user->setZipcode("");
             $user->setCity("");
             $user->setCountry("");
             $user->setPhone("");
             $user->setCreated(new \DateTime("now"));
             $user->setLastModified(new \DateTime("now"));
             //AND SAVE USER TO DB
             $this->getObjectManager()->persist($user);
             $this->getObjectManager()->flush();
             // $newId = $user->getId();
             //COMPOSE AND SEND ACTIVATION MAIL
             //@TODO move hostname/baseurl to config
             $url = "http://www.example.net/login?token=" . $token;
             $translator = $this->getServiceLocator()->get('translator');
             //Create text part of mail
             $textContent = sprintf($translator->translate("registration_mail_text"), $url);
             $text = new MimePart($textContent);
             $text->type = "text/plain";
             //Create html part of mail
             $htmlMarkup = sprintf($translator->translate("registration_mail_html"), $url);
             $html = new MimePart($htmlMarkup);
             $html->type = "text/html";
             //Compose mail
             $body = new MimeMessage();
             $body->setParts(array($text, $html));
             $message = new Message();
             //@TODO move email address etc. to config
             $message->addFrom("*****@*****.**", "example.net")->addTo($user->getEmail(), $user->getFirstName() . " " . $user->getLastName())->setSubject($translator->translate("registration_mail_subject"));
             $message->setBody($body);
             $message->setEncoding("UTF-8");
             //Debug mail: echo $message->toString();
             //Depending on how you send mail..
             /*$transport = new SmtpTransport();
             		$options   = new SmtpOptions(array(
                			'name'              => 'localhost.localdomain',
                			'host'              => '127.0.0.1',
                			'connection_class'  => 'login',
                			'connection_config' => array(
                    			'username' => 'user',
                    			'password' => 'pass',
                			),
             		));
             		$transport->setOptions($options);*/
             //Send email
             $transport = new SendmailTransport();
             $transport->send($message);
             //REDIRECT TO SENT-PAGE
             return $this->redirect()->toRoute('home');
         }
     }
     return array('form' => $form);
 }
 public function __set($name, $value)
 {
     $this->__load();
     return parent::__set($name, $value);
 }
 /**
  * {@inheritDoc}
  */
 public function setFromArray($data)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setFromArray', array($data));
     return parent::setFromArray($data);
 }
 /**
  * @return \Zend\Http\Response|ViewModel
  */
 public function detailAction()
 {
     $id = (int) $this->params()->fromRoute('id', 0);
     $action = $this->params()->fromQuery('action', '');
     $helper = new UserHelper($this->getDbAdapter());
     $form = $helper->getForm($this->statusCombo());
     $user = $this->userTable()->getUser($id);
     $isEdit = true;
     $hasImage = 'false';
     $currentImage = "";
     if (!$user) {
         $isEdit = false;
         $user = new User();
     } else {
         $hasImage = is_null($user->getImage()) ? 'false' : 'true';
         $currentImage = $user->getImage();
     }
     $userRoles = $this->userRoleTable()->grantRoles($id);
     if ($action == 'clone') {
         $isEdit = false;
         $id = 0;
         $user->setUserId(0);
     }
     $form->bind($user);
     $request = $this->getRequest();
     if ($request->isPost()) {
         $post_data = array_merge_recursive($request->getPost()->toArray(), $request->getFiles()->toArray());
         if ($isEdit) {
             $post_data['password'] = $user->getPassword();
             $post_data['confirmPassword'] = $user->getPassword();
         } else {
             $post_data['password'] = $this->encryptPassword($post_data['password']);
             $post_data['confirmPassword'] = $this->encryptPassword($post_data['confirmPassword']);
         }
         $form->setData($post_data);
         $form->setInputFilter($helper->getInputFilter($isEdit ? $post_data['userId'] : 0, $post_data['userName']));
         if ($form->isValid()) {
             $db = $this->userTable()->getAdapter();
             $conn = $db->getDriver()->getConnection();
             try {
                 $image = $user->getImage();
                 if ($post_data['hasImage'] == 'false' && empty($image['name'])) {
                     $user->setImage(null);
                 } else {
                     if ($post_data['hasImage'] == 'true' && empty($image['name']) && $isEdit) {
                         $user->setImage($currentImage);
                     }
                 }
                 $conn->beginTransaction();
                 $userId = $this->userTable()->saveUser($user)->getUserId();
                 $grant_roles = isset($post_data['grant_roles']) ? $post_data['grant_roles'] : array();
                 $this->userRoleTable()->saveRoles($userId, $grant_roles);
                 $conn->commit();
                 $this->flashMessenger()->addSuccessMessage('Save successful');
             } catch (\Exception $ex) {
                 $conn->rollback();
                 $this->flashMessenger()->addErrorMessage($ex->getMessage());
             }
             return $this->redirect()->toRoute('user');
         }
     }
     return new ViewModel(array('form' => $form, 'id' => $id, 'isEdit' => $isEdit, 'hasImage' => $hasImage, 'roles' => $this->roleTreeview(), 'userRoles' => $userRoles));
 }
示例#24
0
 /**
  * validate data and register user in DB
  *
  * @return ViewModel
  */
 public function processAction()
 {
     if ($this->request->isPost()) {
         $form = new RegisterForm();
         $data = $this->params()->fromPost();
         $viewModel = new ViewModel();
         $viewModel->setTemplate('user/register/index');
         $viewModel->setVariable("registerForm", $form);
         $form->setData($data);
         if ($form->isValid()) {
             if ($data["password"] == $data["confirm_password"]) {
                 $em = $this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager');
                 $userRepo = $em->getRepository('Application\\Entity\\User');
                 $user = $userRepo->findByEmail($data['email']);
                 if ($user) {
                     $viewModel->setVariable('accountExistError', true);
                     return $viewModel;
                 }
                 $user = new User();
                 $user->setFirstname($data['firstname']);
                 $user->setLastname($data['lastname']);
                 $user->setEmail($data['email']);
                 $user->setPhone($data['phone']);
                 $user->setPassword($data['password']);
                 $user->setBlocked(0);
                 $user->setEmailVerified(0);
                 $user->setPhoneVerified(0);
                 $user->setRole('u');
                 $user->setCreatedDate(time());
                 $em->persist($user);
                 $em->flush();
                 $params = ["email" => $user->getEmail()];
                 //$eventManager = $this->getEventManager()->trigger('sendMail', null, );
                 //TODO continue and send mail by Listener class
                 $this->redirect()->toRoute('user', array('controller' => 'register', 'action' => 'success'));
             } else {
                 $viewModel->setVariable('passwordError', true);
                 return $viewModel;
             }
         } else {
             $viewModel->setVariable('formError', true);
             return $viewModel;
         }
     } else {
         $this->redirect()->toRoute('user', array('controller' => "register", "action" => "index"));
     }
 }
 /**
  * {@inheritDoc}
  */
 public function updatedTimestamps()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'updatedTimestamps', array());
     return parent::updatedTimestamps();
 }
 /**
  * {@inheritDoc}
  */
 public function isUserBlocked()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'isUserBlocked', array());
     return parent::isUserBlocked();
 }
示例#27
0
文件: User.php 项目: yuraigle/zf2spl
 public static function hashPassword(\Application\Entity\User $identity, $password_plain)
 {
     return md5($identity->getSalt() . $password_plain);
 }
示例#28
0
 public function getAvailableServices(\Application\Entity\User $user)
 {
     $userRole = $user->getRole();
     $findBy = array();
     if (!$this->aclService->isAllowed($userRole->getName(), "accessAllServices")) {
         $userId = $user->getId();
         $findBy = array("user" => $userId);
     }
     $rows = $this->doctrineService->getRepository('Application\\Entity\\WorkAt')->findBy($findBy);
     $result = array();
     foreach ($rows as $row) {
         array_push($result, $row->getService());
     }
     return $result;
 }
 /**
  * {@inheritDoc}
  */
 public function setName($name)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setName', array($name));
     return parent::setName($name);
 }