Пример #1
0
 protected function _handleLdapEnabledUser($postedValues, $empNumber)
 {
     $sfUser = sfContext::getInstance()->getUser();
     $password = $postedValues['user_password'];
     $confirmedPassword = $postedValues['re_password'];
     $check1 = empty($password) && empty($confirmedPassword) ? true : false;
     $check2 = $sfUser->getAttribute('ldap.available');
     if ($check1 && $check2) {
         $user = new SystemUser();
         $user->setDateEntered(date('Y-m-d H:i:s'));
         $user->setCreatedBy($sfUser->getAttribute('user')->getUserId());
         $user->user_name = $postedValues['user_name'];
         $user->user_password = md5('');
         $user->emp_number = $empNumber;
         $user->setUserRoleId(2);
         $this->getUserService()->saveSystemUser($user);
     }
 }
Пример #2
0
 public function save()
 {
     $userId = $this->getValue('userId');
     $password = $this->getValue('password');
     $changePasswordCheck = $this->getValue('chkChangePassword');
     $changePasword = false;
     if (empty($userId)) {
         $user = new SystemUser();
         $user->setDateEntered(date('Y-m-d H:i:s'));
         $user->setCreatedBy($this->getOption('sessionUser')->getUserId());
         $user->setUserPassword($this->getValue('password'));
         $changePasword = true;
     } else {
         $this->edited = true;
         $user = $this->getSystemUserService()->getSystemUser($userId);
         $user->setDateModified(date('Y-m-d H:i:s'));
         $user->setModifiedUserId($this->getOption('sessionUser')->getUserId());
         if (!empty($changePasswordCheck)) {
             $user->setUserPassword($this->getValue('password'));
             $changePasword = true;
         }
     }
     $user->setUserRoleId($this->getValue('userType'));
     $empData = $this->getValue('employeeName');
     $user->setEmpNumber($empData['empId']);
     $user->setUserName($this->getValue('userName'));
     $user->setStatus($this->getValue('status'));
     $savedUser = $this->getSystemUserService()->saveSystemUser($user, $changePasword);
     if ($savedUser instanceof SystemUser) {
         $this->setDefault('userId', $savedUser->getId());
     }
     //save secondary password
     $formExtension = PluginFormMergeManager::instance();
     $formExtension->saveMergeForms($this, 'saveSystemUser', 'SystemUserForm');
     return $savedUser;
 }