コード例 #1
0
 /**
  * method onSave()
  * Executed whenever the user clicks at the save button
  */
 function onSave()
 {
     try {
         TTransaction::open('app');
         // open a transaction
         // get the form data into an active record SystemUser
         $object = $this->form->getData('StdClass');
         $this->form->validate();
         // form validation
         $senhaatual = $object->current;
         $senhanova = $object->password;
         $confirmacao = $object->confirmation;
         $usuario = new SystemUser(TSession::getValue("userid"));
         if ($usuario->password == md5($senhaatual)) {
             if ($senhanova == $confirmacao) {
                 $usuario->password = md5($senhanova);
                 $usuario->store();
                 new TMessage('info', TAdiantiCoreTranslator::translate('Record saved'));
             } else {
                 new TMessage('error', "A nova senha deve ser igual a sua confirmação.");
             }
         } else {
             new TMessage('error', "A senha atual não confere.");
         }
         TTransaction::close();
         // close the transaction
         // shows the success message
     } catch (Exception $e) {
         // in case of exception
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // shows the exception error message
         TTransaction::rollback();
         // undo all pending operations
     }
 }
コード例 #2
0
 public function testSearchLeaveSummary()
 {
     $clues['cmbEmpId'] = 1;
     $clues['userType'] = 'ESS';
     $clues['cmbLeaveType'] = '';
     $clues['cmbSubDivision'] = '';
     $clues['cmbJobTitle'] = '';
     $clues['cmbLocation'] = '';
     $clues['subordinates'] = '';
     $clues['cmbWithTerminated'] = '';
     $intendedResults[0] = array('emp_fullname' => 'Ashley Abel', 'leave_type_id' => 'LTY001', 'available_flag' => 1, 'leave_period_id' => null, 'employee_id' => null, 'emp_number' => 2, 'termination_id' => null, 'leave_type_name' => 'Casual', 'no_of_days_allotted' => '0.00', 'leave_brought_forward' => null, 'leave_carried_forward' => null, 'leave_info' => '0.00_0.00_0.00', 'having_taken' => false, 'leave_taken' => '0.00', 'having_scheduled' => false, 'leave_scheduled' => '0.00', 'logged_user_id' => 1, 'leave_type_status' => true);
     $intendedResults[1] = array('emp_fullname' => 'Ashley Abel', 'leave_type_id' => 'LTY002', 'available_flag' => 1, 'leave_period_id' => null, 'employee_id' => null, 'emp_number' => 2, 'termination_id' => null, 'leave_type_name' => 'Medical', 'no_of_days_allotted' => '0.00', 'leave_brought_forward' => null, 'leave_carried_forward' => null, 'leave_info' => '0.00_0.00_0.00', 'having_taken' => false, 'leave_taken' => '0.00', 'having_scheduled' => false, 'leave_scheduled' => '0.00', 'logged_user_id' => 1, 'leave_type_status' => true);
     $leaveSummaryDao = $this->getMock('LeaveSummaryDao', array('searchLeaveSummary'));
     $leaveSummaryDao->expects($this->once())->method('searchLeaveSummary')->with($clues, 0, 20)->will($this->returnValue($intendedResults));
     // TODO: 'BasicUserRoleManager' is used directly. Should be accessed via UserRoleManagerFactory::getUserRoleManager()
     $userRoleManagerMock = $this->getMock('BasicUserRoleManager', array('getAccessibleEntityIds', 'getUser', 'getDataGroupPermissions'));
     $userRoleManagerMock->expects($this->once())->method('getAccessibleEntityIds')->with('Employee')->will($this->returnValue(array(1, 2, 3, 4, 5)));
     $user = new SystemUser();
     $user->setEmpNumber(2);
     $userRoleManagerMock->expects($this->once())->method('getUser')->will($this->returnValue($user));
     $dataGroupPermission = new ResourcePermission(true, true, true, true);
     $userRoleManagerMock->expects($this->exactly(2))->method('getDataGroupPermissions')->with(array('leave_summary'), array(), array(), true)->will($this->returnValue($dataGroupPermission));
     $this->leaveSummaryService->setLeaveSummaryDao($leaveSummaryDao);
     $this->leaveSummaryService->setUserRoleManager($userRoleManagerMock);
     $result = $this->leaveSummaryService->searchLeaveSummary($clues, 0, 20, 1);
     $this->compareArrays($intendedResults, $result);
 }
コード例 #3
0
 /**
  * Save System User
  * 
  * @param SystemUser $systemUser 
  * @return void
  */
 public function saveSystemUser(SystemUser $systemUser)
 {
     try {
         $systemUser->clearRelated('Employee');
         $systemUser->save();
         return $systemUser;
     } catch (Exception $e) {
         throw new DaoException($e->getMessage(), $e->getCode(), $e);
     }
 }
コード例 #4
0
 /**
  * Save System User
  * 
  * @param SystemUser $systemUser 
  * @return void
  */
 public function saveSystemUser(SystemUser $systemUser, $changePassword = false)
 {
     try {
         if ($changePassword) {
             $systemUser->setUserPassword(md5($systemUser->getUserPassword()));
         }
         return $this->getSystemUserDao()->saveSystemUser($systemUser);
     } catch (Exception $e) {
         throw new ServiceException($e->getMessage(), $e->getCode(), $e);
     }
 }
コード例 #5
0
 /**
  * Autenticates the User
  */
 function onLogin()
 {
     try {
         TTransaction::open('liger');
         $data = $this->form->getData('StdClass');
         $this->form->validate();
         $user = SystemUser::autenticate($data->login, $data->password);
         if ($user) {
             $programs = $user->getPrograms();
             $programs['LoginForm'] = TRUE;
             TSession::setValue('logged', TRUE);
             TSession::setValue('login', $data->login);
             TSession::setValue('username', $user->name);
             TSession::setValue('frontpage', '');
             TSession::setValue('programs', $programs);
             $frontpage = $user->frontpage;
             if ($frontpage instanceof SystemProgram and $frontpage->controller) {
                 TApplication::gotoPage($frontpage->controller);
                 // reload
                 TSession::setValue('frontpage', $frontpage->controller);
             } else {
                 TApplication::gotoPage('EmptyPage');
                 // reload
                 TSession::setValue('frontpage', 'EmptyPage');
             }
         }
         TTransaction::close();
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
         TSession::setValue('logged', FALSE);
         TTransaction::rollback();
     }
 }
コード例 #6
0
 public function onSave($param)
 {
     try {
         $this->form->validate();
         $object = $this->form->getData();
         TTransaction::open('permission');
         $user = SystemUser::newFromLogin(TSession::getValue('login'));
         $user->name = $object->name;
         $user->email = $object->email;
         if ($object->password1) {
             if ($object->password1 != $object->password2) {
                 throw new Exception(_t('The passwords do not match'));
             }
             $user->password = md5($object->password1);
         } else {
             unset($user->password);
         }
         $user->store();
         $this->form->setData($object);
         new TMessage('info', TAdiantiCoreTranslator::translate('Record saved'));
         TTransaction::close();
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
コード例 #7
0
 /**
  * Returns an indexed array with all programs
  */
 public function getPrograms()
 {
     try {
         TTransaction::open('permission');
         $user = SystemUser::newFromLogin(TSession::getValue('login'));
         return $user->getProgramsList();
         TTransaction::close();
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
コード例 #8
0
 public function testGetUserRoleManagerExistingClass()
 {
     $configDao = $this->getMock('ConfigDao', array('getValue'));
     $configDao->expects($this->once())->method('getValue')->with(UserRoleManagerService::KEY_USER_ROLE_MANAGER_CLASS)->will($this->returnValue('UnitTestUserRoleManager'));
     $authenticationService = $this->getMock('AuthenticationService', array('getLoggedInUserId'));
     $authenticationService->expects($this->once())->method('getLoggedInUserId')->will($this->returnValue(211));
     $systemUser = new SystemUser();
     $systemUser->setId(211);
     $systemUserService = $this->getMock('SystemUserService', array('getSystemUser'));
     $systemUserService->expects($this->once())->method('getSystemUser')->will($this->returnValue($systemUser));
     $this->service->setConfigDao($configDao);
     $this->service->setAuthenticationService($authenticationService);
     $this->service->setSystemUserService($systemUserService);
     $manager = $this->service->getUserRoleManager();
     $this->assertNotNull($manager);
     $this->assertTrue($manager instanceof AbstractUserRoleManager);
     $this->assertTrue($manager instanceof UnitTestUserRoleManager);
     $user = $manager->getUser();
     $this->assertEquals($systemUser, $user);
 }
コード例 #9
0
ファイル: User.php プロジェクト: rverbrugge/dif
 public function __construct()
 {
     parent::__construct();
     $this->template = array();
     $this->templateFile = "user.tpl";
     $this->basePath = realpath(dirname(__FILE__) . "/../") . "/";
     // data tha will be exported or imported (updated)
     $this->exportColumns = array('active' => 'active', 'notify' => 'notify', 'role' => 'role', 'name' => 'name', 'firstname' => 'firstname', 'address' => 'address', 'address_nr' => 'address_nr', 'zipcode' => 'zipcode', 'city' => 'city', 'country' => 'country', 'phone' => 'phone', 'mobile' => 'mobile', 'email' => 'email', 'username' => 'username', 'password' => 'password');
     $view = ViewManager::getInstance();
     $view->insert(self::VIEW_IMPORT, 'Gebruikers importeren');
     $view->insert(self::VIEW_IMPORT_TEMPL, 'Csv template');
     $view->insert(self::VIEW_EXPORT, 'Gebruikers exporteren');
 }
コード例 #10
0
ファイル: Session.class.php プロジェクト: fulldump/8
 public static function login($user, $pass)
 {
     if (!self::isLoggedIn()) {
         $user = SystemUser::validate($user, $pass);
         if ($user != null) {
             if (null === self::$_system_session) {
                 self::_create_session();
             }
             self::$_system_session->setUser($user);
             return true;
         }
     }
     return false;
 }
コード例 #11
0
 /**
  * @expectedException DaoException
  */
 public function testSaveSystemUserWithExistingUserName()
 {
     $systemUser = new SystemUser();
     $systemUser->setUserRoleId(1);
     $systemUser->setEmpNumber(2);
     $systemUser->setUserName('samantha');
     $systemUser->setUserPassword('orangehrm');
     $this->systemUserDao->saveSystemUser($systemUser);
 }
コード例 #12
0
 public function __construct()
 {
     parent::__construct();
     $html = new THtmlRenderer('app/resources/profile.html');
     $replaces = array();
     try {
         TTransaction::open('permission');
         $user = SystemUser::newFromLogin(TSession::getValue('login'));
         $replaces = $user->toArray();
         $replaces['frontpage'] = $user->frontpage_name;
         $replaces['groupnames'] = $user->getSystemUserGroupNames();
         TTransaction::close();
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
     $html->enableSection('main', $replaces);
     $html->enableTranslation();
     $bc = new TBreadCrumb();
     $bc->addHome();
     $bc->addItem('Perfil');
     $container = TVBox::pack($bc, $html);
     $container->style = 'width:60%';
     parent::add($container);
 }
コード例 #13
0
 private function editSystemUser()
 {
     $systemUserId = $this->requestParameter['systemUserId'];
     if ($this->requestParameter['submit']) {
         $objSystemUser = new SystemUser();
         $objSystemUserValidator = NCConfigFactory::getInstance()->getSystemUserValidator();
         $objSystemUser->setSystemUserId($systemUserId);
         $objSystemUser->setSystemUserRefName($this->requestParameter['systemUserRefName']);
         $objSystemUser->setUsername($this->requestParameter['username']);
         $objSystemUser->setPassword($this->requestParameter['password']);
         $errorArray = $objSystemUserValidator->editValidation($objSystemUser);
         if ($errorArray) {
             $errorArray['error'] = 'ERROR';
             echo json_encode($errorArray);
         } else {
             $systemUserId = $this->objSystemUserManager->editSystemUser($objSystemUser);
             echo json_encode(array('systemUserId' => $systemUserId));
         }
     }
 }
コード例 #14
0
 /**
  * method Delete()
  * Delete a record
  */
 function Delete($param)
 {
     try {
         // get the parameter $key
         $key = $param['key'];
         // open a transaction with database 'permission'
         TTransaction::open('permission');
         // instantiates object System_user
         $object = new SystemUser($key);
         // deletes the object from the database
         $object->delete();
         // close the transaction
         TTransaction::close();
         // reload the listing
         $this->onReload($param);
         // shows the success message
         new TMessage('info', TAdiantiCoreTranslator::translate('Record deleted'));
     } catch (Exception $e) {
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // undo all pending operations
         TTransaction::rollback();
     }
 }
コード例 #15
0
 /**
  * method onEdit()
  * Executed whenever the user clicks at the edit button da datagrid
  */
 function onEdit($param)
 {
     try {
         if (isset($param['key'])) {
             // get the parameter $key
             $key = $param['key'];
             // open a transaction with database 'permission'
             TTransaction::open('permission');
             // instantiates object System_user
             $object = new SystemUser($key);
             unset($object->password);
             $groups = array();
             if ($groups_db = $object->getSystemUserGroups()) {
                 foreach ($groups_db as $grup) {
                     $groups[] = $grup->id;
                 }
             }
             $object->programs = $object->getSystemUserPrograms();
             $object->groups = $groups;
             // fill the form with the active record data
             $this->form->setData($object);
             // close the transaction
             TTransaction::close();
         } else {
             $this->form->clear();
         }
     } catch (Exception $e) {
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // undo all pending operations
         TTransaction::rollback();
     }
 }
コード例 #16
0
require '../inc/classes/Helpers.php';
// page vars
$page_title = "";
$id = $_REQUEST['id'];
// id required
if ($id == "") {
    header("Location:mainpage.php");
    exit;
}
// if form was submitted
if ($_POST['commit'] == "Cancel") {
    header("Location:user_list.php");
    exit;
}
if ($_POST['commit'] == "Delete User") {
    $objSystemUser = new SystemUser();
    $objSystemUser->delete($id);
    header("Location:user_list.php");
    exit;
}
$objSystemUser = new SystemUser($id);
include "includes/pagetemplate.php";
function PageContent()
{
    global $objSystemUser;
    global $id;
    ?>

            <div class="layout laymidwidth">

                <?php 
コード例 #17
0
     $objSystemUser->FirstName = $_REQUEST['first_name'];
     $objSystemUser->LastName = $_REQUEST['last_name'];
     $objSystemUser->EmailAddress = $_REQUEST['email_address'];
     $objSystemUser->Password = $_REQUEST['password'];
     $is_admin = 0;
     if (isset($_REQUEST['is_admin'])) {
         $is_admin = 1;
     }
     $objSystemUser->IsAdmin = $is_admin;
     $objSystemUser->DateAdded = date('Y-d-m H:i:s');
     $objSystemUser->create();
     // redirect to listing list
     header("Location:user_list.php");
     exit;
 } else {
     $objSystemUser = new SystemUser($_REQUEST["id"]);
     $objSystemUser->FirstName = $_REQUEST['first_name'];
     $objSystemUser->LastName = $_REQUEST['last_name'];
     $objSystemUser->EmailAddress = $_REQUEST['email_address'];
     if (isset($_REQUEST['password'])) {
         $objSystemUser->Password = $_REQUEST['password'];
     }
     $is_admin = 0;
     if (isset($_REQUEST['is_admin'])) {
         $is_admin = 1;
     }
     $objSystemUser->IsAdmin = $is_admin;
     $objSystemUser->update();
     // redirect to listing list
     header("Location:user_list.php");
     exit;
コード例 #18
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      SystemUser $value A SystemUser object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(SystemUser $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         if (isset(self::$instances[$key]) || count(self::$instances) < kConf::get('max_num_instances_in_pool')) {
             self::$instances[$key] = $obj;
             kMemoryManager::registerPeer('SystemUserPeer');
         }
     }
 }
コード例 #19
0
 public function import($data)
 {
     set_time_limit(90);
     if ($data[0] == "" || strlen($data[0]) > 30) {
         return false;
     }
     $createUser = false;
     $empService = new EmployeeService();
     $employee = $empService->getEmployeeByEmployeeId($data[0]);
     if (empty($employee)) {
         $employee = new Employee();
         $createUser = true;
     }
     if (strlen($data[0]) <= 50) {
         $employee->setEmployeeId($data[0]);
     }
     $employee->setFirstName($data[1]);
     if (strlen($data[2]) <= 30) {
         $employee->setMiddleName($data[2]);
     }
     $employee->setLastName($data[3]);
     if (strlen($data[4]) <= 30) {
         $employee->setOtherId($data[4]);
     }
     if (strlen($data[5]) <= 30) {
         $employee->setBloodGroup($data[5]);
     }
     if ($data[6] != "") {
         $dob = $this->formatDate($data[6]);
         $employee->setEmpBirthday($dob);
     }
     if (strtolower($data[7]) == 'male') {
         $employee->setEmpGender('1');
     } else {
         if (strtolower($data[7]) == 'female') {
             $employee->setEmpGender('2');
         }
     }
     if (strtolower($data[8]) == 'single') {
         $employee->setEmpMaritalStatus('Single');
     } else {
         if (strtolower($data[8]) == 'married') {
             $employee->setEmpMaritalStatus('Married');
         } else {
             if (strtolower($data[8]) == 'other') {
                 $employee->setEmpMaritalStatus('Other');
             }
         }
     }
     $nationality = $this->isValidNationality($data[9]);
     if (!empty($nationality)) {
         $employee->setNationality($nationality);
     }
     if (strlen($data[10]) <= 70) {
         $employee->setFatherName($data[10]);
     }
     if (strlen($data[11]) <= 70) {
         $employee->setHusbandName($data[11]);
     }
     if (strlen($data[12]) <= 70) {
         $employee->setStreet1($data[12]);
     }
     if (strlen($data[13]) <= 70) {
         $employee->setStreet2($data[13]);
     }
     if (strlen($data[14]) <= 70) {
         $employee->setCity($data[14]);
     }
     if (strlen($data[16]) <= 10) {
         $employee->setEmpZipcode($data[16]);
     }
     $code = $this->isValidCountry($data[17]);
     if (!empty($code)) {
         $employee->setCountry($code);
         if (strtolower($data[17]) == 'united states') {
             $code = $this->isValidProvince($data[15]);
             if (!empty($code)) {
                 $employee->setProvince($code);
             }
         } else {
             if (strlen($data[15]) <= 70) {
                 $employee->setProvince($data[15]);
             }
         }
     }
     if (strlen($data[18]) <= 100) {
         $employee->setPermanentAddress($data[18]);
     }
     if ($this->isValidEmail($data[19]) && strlen($data[19]) <= 50 && $this->isUniqueEmail($data[19])) {
         $employee->setEmpWorkEmail($data[19]);
     }
     if ($this->isValidEmail($data[20]) && strlen($data[20]) <= 50) {
         $employee->setEmpOthEmail($data[20]);
     }
     if ($this->isValidEmail($data[21]) && strlen($data[21]) <= 50) {
         $employee->setEmpPersonalEmail($data[21]);
     }
     if (strlen($data[22]) <= 25 && $this->isValidPhoneNumber($data[22])) {
         $employee->setEmpMobile($data[22]);
     }
     if (strlen($data[23]) <= 25 && $this->isValidPhoneNumber($data[23])) {
         $employee->setEmpWorkTelephone($data[23]);
     }
     if (strlen($data[24]) <= 25 && $this->isValidPhoneNumber($data[24])) {
         $employee->setEmpHmTelephone($data[24]);
     }
     if (strlen($data[25]) <= 50) {
         $employee->setEmpPhoneAccesscode($data[25]);
     }
     if (strlen($data[26]) <= 50) {
         $employee->setEmpSkypeId($data[26]);
     }
     if ($data[27] != "") {
         $joinedDate = $this->formatDate($data[27]);
         $employee->setJoinedDate($joinedDate);
     }
     $jobTitle = $this->isValidJobTitle($data[28]);
     if (!empty($jobTitle)) {
         $employee->setJobTitleCode($jobTitle);
     }
     if ($data[29] != "" && is_numeric($data[29])) {
         $employee->setTotalExperience($data[29]);
     }
     if ($data[30] != "" && is_numeric($data[30])) {
         $employee->setCurrentExperience($data[30]);
     }
     if ($data[31] != "" && is_numeric($data[31])) {
         $employee->setNoticePeriod($data[31]);
     }
     if (strlen($data[32]) <= 50) {
         $employee->setProject($data[32]);
     }
     if (strlen($data[33]) <= 50) {
         $employee->setReferredBy($data[33]);
     }
     if (strlen($data[34]) <= 50) {
         $employee->setCustom4($data[34]);
     }
     if (strlen($data[38]) <= 50) {
         $employee->setCustom2($data[38]);
     }
     if (strlen($data[39]) <= 50) {
         $employee->setCustom3($data[39]);
     }
     if (strlen($data[40]) <= 50) {
         $employee->setCustom1($data[40]);
     }
     $employee = $empService->saveEmployee($employee);
     if ($data[35] != "" && $data[36] != "") {
         $employeeSalary = new EmployeeSalary();
         $employeeSalary->setSalaryName("CTC");
         $employeeSalary->setPayPeriodId("4");
         $employeeSalary->setCurrencyCode($data[36]);
         $employeeSalary->setAmount($data[35]);
         $employeeSalary->setEmpNumber($employee);
         $empDirectDebit = new EmpDirectdebit();
         $empDirectDebit->setAccount($data[37]);
         $empDirectDebit->setAccountType("SAVINGS");
         $employeeSalary->setDirectDebit($empDirectDebit);
         $empService->saveEmployeeSalary($employeeSalary);
     }
     if ($data[41] != "" && strlen($data[41]) <= 50) {
         $empPassport = new EmployeeImmigrationRecord();
         $empPassport->setEmployee($employee);
         $empPassport->setNumber($data[41]);
         $empPassport->setCountryCode($data[42]);
         if ($data[43] != "") {
             $expiryDate = $this->formatDate($data[43]);
             $empPassport->setExpiryDate($expiryDate);
         }
         $empPassport->setType(1);
         $empService->saveEmployeeImmigrationRecord($empPassport);
     }
     if ($data[44] != "" && strlen($data[44]) <= 50) {
         $empVisaDetails = new EmployeeImmigrationRecord();
         $empVisaDetails->setEmployee($employee);
         $empVisaDetails->setNumber($data[44]);
         if ($data[45] != "") {
             $visaExpiryDate = $this->formatDate($data[45]);
             $empVisaDetails->setExpiryDate($visaExpiryDate);
         }
         $empVisaDetails->setType(2);
         $empService->saveEmployeeImmigrationRecord($empVisaDetails);
     }
     if ($data[46] != "" && $data[46] != '0' && strlen($data[46]) <= 50) {
         $sequence1 = 1;
         //$this->getDependentSeqNo($employee->getEmpNumber());
         $dependent1 = $this->getEmployeeDependent($employee->getEmpNumber(), $sequence1);
         $dependent1->setEmployee($employee);
         $dependent1->setSeqno($sequence1);
         $dependent1->setName($data[46]);
         if ($data[47] != "") {
             $dependent1->setDateOfBirth($this->formatDate($data[47]));
         }
         $dependent1->setRelationshipType($data[48]);
         $dependent1->setRelationship($data[49]);
         $dependent1->save();
     }
     if ($data[50] != "" && $data[50] != '0' && strlen($data[50]) <= 50) {
         $sequence2 = 2;
         //$this->getDependentSeqNo($employee->getEmpNumber());
         $dependent2 = $this->getEmployeeDependent($employee->getEmpNumber(), $sequence2);
         $dependent2->setEmployee($employee);
         $dependent2->setSeqno($sequence2);
         $dependent2->setName($data[50]);
         if ($data[51] != "") {
             $dependent2->setDateOfBirth($this->formatDate($data[51]));
         }
         $dependent2->setRelationshipType($data[52]);
         $dependent2->setRelationship($data[53]);
         $dependent2->save();
     }
     if ($data[54] != "" && $data[54] != '0' && strlen($data[54]) <= 50) {
         $sequence3 = 3;
         //$this->getDependentSeqNo($employee->getEmpNumber());
         $dependent3 = $this->getEmployeeDependent($employee->getEmpNumber(), $sequence3);
         $dependent3->setEmployee($employee);
         $dependent3->setSeqno($sequence3);
         $dependent3->setName($data[54]);
         if ($data[55] != "") {
             $dependent3->setDateOfBirth($this->formatDate($data[55]));
         }
         $dependent3->setRelationshipType($data[56]);
         $dependent3->setRelationship($data[57]);
         $dependent3->save();
     }
     if ($createUser && $data[58] != "" && $data[59] != "") {
         $user = new SystemUser();
         $user->setDateEntered(date('Y-m-d H:i:s'));
         //$user->setCreatedBy($sfUser->getAttribute('user')->getUserId());
         $user->setUserName($data[58]);
         $user->setUserPassword(md5($data[59]));
         $user->setEmployee($employee);
         $user->setUserRoleId(2);
         $this->getUserService()->saveSystemUser($user);
     }
     return true;
 }
コード例 #20
0
ファイル: auto.class.php プロジェクト: fulldump/8
 public function getUser()
 {
     if ($this->row['User'] == 0) {
         return null;
     } else {
         return SystemUser::ROW($this->row['User']);
     }
 }
コード例 #21
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      SystemUser $value A SystemUser object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(SystemUser $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
コード例 #22
0
ファイル: index.php プロジェクト: fulldump/8
<div class="frame">

	<h1>Change password</h1>

	<form method="POST" action="">

		<?php 
if (isset($_POST['action']) && 'change_password' === $_POST['action']) {
    if ($_POST['new_password'] !== $_POST['repeat_password']) {
        echo '<div class="msg msg-error">Password confirmation does not match.</div>';
    } else {
        if (strlen($_POST['new_password']) < 10) {
            echo '<div class="msg msg-error">New password must be at least 10 chars length.</div>';
        } else {
            if (SystemUser::validate(Session::getUser()->getLogin(), $_POST['old_password'])) {
                Session::getUser()->setPassword($_POST['new_password']);
                Session::closeAll();
                Session::logout();
                echo '<div class="msg msg-info">Password has been changed. Please, log in again.</div>';
            } else {
                echo '<div class="msg msg-error">Wrong old password.</div>';
            }
        }
    }
}
?>



		<label>Old password<input type="password" name="old_password"></label>
		<label>New password<input type="password" name="new_password"></label>
コード例 #23
0
ファイル: make_question.php プロジェクト: fulldump/8
			<div class="fecha" title="Hora: ' . date('H', $date) . ':' . date('i', $date) . '" style="    color: gray;    float: left;    font-weight: bold;    text-align: center;    width: 48px;">
				<div class="dia" style="font-size: 28px;">' . date('d', $date) . '</div>
				<div class="mes" style="">' . date('M', $date) . '</div>
				<div class="ano" style="font-size: 10px;">' . date('Y', $date) . '</div>
			</div>
			<div class="botones margen" style="clear: right; float: right; padding: 16px;">
				<a href="http://' . $_SERVER['HTTP_HOST'] . Config::get('FORUM_URL') . '?pregunta=' . $pregunta->getQuestion()->getId() . '#q' . $pregunta->getId() . '" class="shadow-button shadow-button-blue" style="    border: 1px solid silver;    border-radius: 3px 3px 3px 3px;    color: white;    cursor: pointer;    font-size: 12px;    font-weight: bold;    margin: 0;    padding: 7px;    text-transform: uppercase; background-color: #4D90FE; text-decoration:none;">Responder</a>
			</div>
			<div style="margin-left: 48px; padding: 16px;">
				<div class="pie" style="">
					' . $autor_txt . '
				</div>
				' . Lib::colorizeHTML($pregunta->getText()) . '
			</div>
		</div>
		<br>
		<br>
		Enlace para responder <a href="http://' . $_SERVER['HTTP_HOST'] . Config::get('FORUM_URL') . '?pregunta=' . $pregunta->getQuestion()->getId() . '#q' . $pregunta->getId() . '">http://' . $_SERVER['HTTP_HOST'] . Config::get('FORUM_URL') . '?pregunta=' . $pregunta->getQuestion()->getId() . '#q' . $pregunta->getId() . '</a>
		';
$headers = "MIME-Version: 1.0\n";
$headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";
$headers .= 'Message-ID: <' . md5($pregunta->getQuestion()->getId()) . '@ibentus.treeweb.es>' . "\n";
$headers .= "Reply-To: " . $login . "\n";
$headers .= "From: " . Config::get('FORUM_SENDER_EMAIL') . "\n";
$headers .= "X-Priority: 1 (Higuest)\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "Importance: High\n";
$usuarios = SystemUser::SELECT();
foreach ($usuarios as $u) {
    $ok = mail($u->getLogin(), $subject, $message, $headers);
}
コード例 #24
0
 public function testGetCredentialsInvalidPassword()
 {
     $userId = 3838;
     $userName = '******';
     $password = '******';
     $hashedPassword = '******';
     $user = new SystemUser();
     $user->setId($userId);
     $user->setUserRoleId(1);
     $user->setUserName($userName);
     $user->setUserPassword($hashedPassword);
     $mockDao = $this->getMock('SystemUserDao', array('isExistingSystemUser'));
     $mockDao->expects($this->once())->method('isExistingSystemUser')->with($userName)->will($this->returnValue($user));
     $this->systemUserService->setSystemUserDao($mockDao);
     $result = $this->systemUserService->getCredentials($userName, $password);
     $this->assertFalse($result);
 }
コード例 #25
0
 public function testFilterRolesSupervisorForEmployee()
 {
     $testManager = new TestBasicUserRoleManager();
     $userRoles = $this->__convertRoleNamesToObjects(array('Supervisor', 'Admin', 'RegionalAdmin'));
     $roles = $testManager->filterUserRolesPublic($userRoles, $rolesToExclude, $rolesToInclude);
     $this->assertEquals($userRoles, $roles);
     $rolesToExclude = array();
     $rolesToInclude = array();
     $user = new SystemUser();
     $user->setId(11);
     $user->setEmpNumber(9);
     $systemUserService = $this->getMock('SystemUserService', array('getSystemUser'));
     $systemUserService->expects($this->once())->method('getSystemUser')->will($this->returnValue($user));
     $testManager->setSystemUserService($systemUserService);
     $testManager->setUser($user);
     $employeeIds = array(1, 2, 3);
     $employeeService = $this->getMock('EmployeeService', array('getSubordinateIdListBySupervisorId'));
     $employeeService->expects($this->once())->method('getSubordinateIdListBySupervisorId')->with($user->getEmpNumber())->will($this->returnValue($employeeIds));
     $testManager->setEmployeeService($employeeService);
     // Test that supervisor role is returned for Employee who is a subordinate
     $roles = $testManager->filterUserRolesPublic($userRoles, $rolesToExclude, $rolesToInclude, array('Employee' => 3));
     $this->assertEquals($userRoles, $roles);
     // Test that supervisor role is not returned for Employee who is not a subordinate
     $roles = $testManager->filterUserRolesPublic($userRoles, $rolesToExclude, $rolesToInclude, array('Employee' => 13));
     $this->assertEquals(array($userRoles[1], $userRoles[2]), $roles);
 }
コード例 #26
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;
 }
コード例 #27
0
 public function actionDeleteAll()
 {
     $ids = $_REQUEST['ids'];
     $crit = new CDbCriteria();
     $crit->condition = "id IN ({$ids})";
     SystemUser::model()->deleteAll($crit);
     Yii::app()->user->setFlash('success', "Ðã xóa thành công");
     $this->redirect(Yii::app()->request->urlReferrer);
 }
コード例 #28
0
 /**
  *
  * @param Users $user 
  * @deprecated
  */
 protected function setRoleBasedUserAttributesToSession(SystemUser $user)
 {
     $isNotAdmin = $user->getIsAdmin() == 'No';
     $authorizeObj = Auth::instance();
     $_SESSION['isSupervisor'] = $isNotAdmin ? $authorizeObj->hasRole(Auth::SUPERVISOR_ROLE) : false;
     $_SESSION['isProjectAdmin'] = $isNotAdmin ? $authorizeObj->hasRole(Auth::PROJECTADMIN_ROLE) : false;
     $_SESSION['isManager'] = $isNotAdmin ? $authorizeObj->hasRole(Auth::MANAGER_ROLE) : false;
     $_SESSION['isDirector'] = $isNotAdmin ? $authorizeObj->hasRole(Auth::DIRECTOR_ROLE) : false;
     $_SESSION['isAcceptor'] = $isNotAdmin ? $authorizeObj->hasRole(Auth::INTERVIEWER) : false;
     $_SESSION['isOfferer'] = $isNotAdmin ? $authorizeObj->hasRole(Auth::HIRINGMANAGER_ROLE) : false;
     $_SESSION['isHiringManager'] = $isNotAdmin ? $authorizeObj->hasRole(Auth::HIRINGMANAGER_ROLE) : false;
     $_SESSION['isInterviewer'] = $isNotAdmin ? $authorizeObj->hasRole(Auth::INTERVIEWER) : false;
 }
コード例 #29
0
ファイル: AddEmployeeForm.php プロジェクト: THM068/orangehrm
 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);
     }
 }
コード例 #30
0
ファイル: LoginMailer.php プロジェクト: rverbrugge/dif
 private function handleActivatePost()
 {
     $request = Request::getInstance();
     $view = ViewManager::getInstance();
     $systemUser = new SystemUser();
     $loginRequest = new LoginRequest();
     $view->setType(self::VIEW_ACTIVATE);
     try {
         if (!$request->exists('tag')) {
             throw new Exception('Tag ontbreekt.');
         }
         if (!$request->exists('key')) {
             throw new Exception('Key is missing.');
         }
         $key = $request->getValue('key');
         if (!$key) {
             throw new Exception('Key is missing.');
         }
         // get request details
         $requestKey = array('request_key' => $key);
         if (!$loginRequest->exists($requestKey)) {
             throw new Exception('Request does not exist.');
         }
         $requestInfo = $loginRequest->getDetail($requestKey);
         // get user details
         $userKey = array('id' => $requestInfo['usr_id']);
         if (!$systemUser->exists($userKey)) {
             throw new Exception('Request does not exist.');
         }
         $user = $systemUser->getDetail(array('id' => $requestInfo['usr_id']));
         $tree = $this->director->tree;
         $tag = $request->getValue('tag');
         $tree_id = $tree->getCurrentId();
         $key = array('tree_id' => $tree_id, 'tag' => $tag);
         $settings = $this->getDetail($key);
         // hide old password and change with password validation
         $newpass1 = $request->getValue('newpass1');
         $newpass2 = $request->getValue('newpass2');
         if (!$newpass1 && !$newpass2) {
             throw new Exception("Password is missing.");
         }
         if ($newpass1 == $newpass2) {
             $systemUser->setPassword($userKey, $newpass1);
         } else {
             throw new Exception("Passwords do not match.");
         }
         // delete request
         //$loginRequest->delete($requestKey);
         $referer = $settings['fin_tree_id'] ? $tree->getPath($settings['fin_tree_id'], '/', Tree::TREE_ORIGINAL) : ($request->exists('referer') ? $request->getValue('referer') : '/');
         header("Location: {$referer}");
         exit;
     } catch (Exception $e) {
         $template = new TemplateEngine();
         $template->setVariable('formError', $e->getMessage(), false);
         $this->handleHttpGetRequest();
     }
 }