2010-12-02 23:34:41 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
2017-08-01 12:16:06 -04:00
|
|
|
|
use ProcessMaker\Plugins\PluginRegistry;
|
|
|
|
|
|
|
2010-12-02 23:34:41 +00:00
|
|
|
|
require_once 'classes/model/om/BaseUsersProperties.php';
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Skeleton subclass for representing a row from the 'USERS_PROPERTIES' table.
|
|
|
|
|
|
*
|
|
|
|
|
|
*
|
|
|
|
|
|
*
|
|
|
|
|
|
* You should add additional methods to this class to meet the
|
2012-10-19 10:24:29 -04:00
|
|
|
|
* application requirements. This class will only be generated as
|
2010-12-02 23:34:41 +00:00
|
|
|
|
* long as it does not already exist in the output directory.
|
2011-02-03 11:13:21 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2012-10-19 10:24:29 -04:00
|
|
|
|
*
|
|
|
|
|
|
* @package workflow.engine.classes.model
|
2010-12-02 23:34:41 +00:00
|
|
|
|
*/
|
2012-09-25 17:33:17 -04:00
|
|
|
|
class UsersProperties extends BaseUsersProperties
|
2012-01-31 18:45:30 -04:00
|
|
|
|
{
|
2012-10-19 10:24:29 -04:00
|
|
|
|
public $fields = null;
|
|
|
|
|
|
public $usrID = '';
|
|
|
|
|
|
public $lang = 'en';
|
|
|
|
|
|
|
2012-10-20 16:01:28 -04:00
|
|
|
|
public function __construct ()
|
2012-10-19 10:24:29 -04:00
|
|
|
|
{
|
|
|
|
|
|
$this->lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2012-10-20 16:01:28 -04:00
|
|
|
|
public function UserPropertyExists ($sUserUID)
|
2012-10-19 10:24:29 -04:00
|
|
|
|
{
|
|
|
|
|
|
$oUserProperty = UsersPropertiesPeer::retrieveByPk( $sUserUID );
|
|
|
|
|
|
if (! is_null( $oUserProperty ) && is_object( $oUserProperty ) && get_class( $oUserProperty ) == 'UsersProperties') {
|
|
|
|
|
|
$this->fields = $oUserProperty->toArray( BasePeer::TYPE_FIELDNAME );
|
|
|
|
|
|
$this->fromArray( $this->fields, BasePeer::TYPE_FIELDNAME );
|
|
|
|
|
|
return true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
|
}
|
2012-10-19 10:24:29 -04:00
|
|
|
|
|
|
|
|
|
|
public function load ($sUserUID)
|
|
|
|
|
|
{
|
|
|
|
|
|
$oUserProperty = UsersPropertiesPeer::retrieveByPK( $sUserUID );
|
|
|
|
|
|
if (! is_null( $oUserProperty )) {
|
|
|
|
|
|
$aFields = $oUserProperty->toArray( BasePeer::TYPE_FIELDNAME );
|
|
|
|
|
|
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
|
|
|
|
|
return $aFields;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
throw new Exception( "User with $sUserUID does not exist!" );
|
|
|
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
|
}
|
2012-10-19 10:24:29 -04:00
|
|
|
|
|
|
|
|
|
|
public function create ($aData)
|
|
|
|
|
|
{
|
|
|
|
|
|
$oConnection = Propel::getConnection( UsersPropertiesPeer::DATABASE_NAME );
|
|
|
|
|
|
try {
|
|
|
|
|
|
$oUserProperty = new UsersProperties();
|
|
|
|
|
|
$oUserProperty->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
|
|
|
|
|
if ($oUserProperty->validate()) {
|
|
|
|
|
|
$oConnection->begin();
|
|
|
|
|
|
$iResult = $oUserProperty->save();
|
|
|
|
|
|
$oConnection->commit();
|
|
|
|
|
|
return true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$sMessage = '';
|
|
|
|
|
|
$aValidationFailures = $oUserProperty->getValidationFailures();
|
|
|
|
|
|
foreach ($aValidationFailures as $oValidationFailure) {
|
|
|
|
|
|
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
|
|
|
|
|
}
|
|
|
|
|
|
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (Exception $oError) {
|
|
|
|
|
|
$oConnection->rollback();
|
|
|
|
|
|
throw ($oError);
|
|
|
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
|
}
|
2012-10-19 10:24:29 -04:00
|
|
|
|
|
|
|
|
|
|
public function update ($aData)
|
|
|
|
|
|
{
|
|
|
|
|
|
$oConnection = Propel::getConnection( UsersPropertiesPeer::DATABASE_NAME );
|
|
|
|
|
|
try {
|
|
|
|
|
|
$oUserProperty = UsersPropertiesPeer::retrieveByPK( $aData['USR_UID'] );
|
|
|
|
|
|
if (! is_null( $oUserProperty )) {
|
|
|
|
|
|
$oUserProperty->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
|
|
|
|
|
if ($oUserProperty->validate()) {
|
|
|
|
|
|
$oConnection->begin();
|
|
|
|
|
|
$iResult = $oUserProperty->save();
|
|
|
|
|
|
$oConnection->commit();
|
|
|
|
|
|
return $iResult;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$sMessage = '';
|
|
|
|
|
|
$aValidationFailures = $oUserProperty->getValidationFailures();
|
|
|
|
|
|
foreach ($aValidationFailures as $oValidationFailure) {
|
|
|
|
|
|
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
|
|
|
|
|
}
|
|
|
|
|
|
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
throw (new Exception( 'This row doesn\'t exist!' ));
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (Exception $oError) {
|
|
|
|
|
|
$oConnection->rollback();
|
|
|
|
|
|
throw ($oError);
|
2010-12-02 23:34:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2012-10-19 10:24:29 -04:00
|
|
|
|
|
|
|
|
|
|
public function loadOrCreateIfNotExists ($sUserUID, $aUserProperty = array())
|
|
|
|
|
|
{
|
|
|
|
|
|
if (! $this->UserPropertyExists( $sUserUID )) {
|
|
|
|
|
|
$aUserProperty['USR_UID'] = $sUserUID;
|
|
|
|
|
|
if (! isset( $aUserProperty['USR_LAST_UPDATE_DATE'] )) {
|
|
|
|
|
|
$aUserProperty['USR_LAST_UPDATE_DATE'] = date( 'Y-m-d H:i:s' );
|
|
|
|
|
|
}
|
|
|
|
|
|
if (! isset( $aUserProperty['USR_LOGGED_NEXT_TIME'] )) {
|
|
|
|
|
|
$aUserProperty['USR_LOGGED_NEXT_TIME'] = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
$this->create( $aUserProperty );
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$aUserProperty = $this->fields;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return $aUserProperty;
|
2010-12-02 23:34:41 +00:00
|
|
|
|
}
|
2012-10-19 10:24:29 -04:00
|
|
|
|
|
2014-06-12 16:02:32 -04:00
|
|
|
|
public function validatePassword ($sPassword, $sLastUpdate, $iChangePasswordNextTime, $nowLogin = false)
|
2012-10-19 10:24:29 -04:00
|
|
|
|
{
|
|
|
|
|
|
if (! defined( 'PPP_MINIMUM_LENGTH' )) {
|
|
|
|
|
|
define( 'PPP_MINIMUM_LENGTH', 5 );
|
2010-12-02 23:34:41 +00:00
|
|
|
|
}
|
2012-10-19 10:24:29 -04:00
|
|
|
|
if (! defined( 'PPP_MAXIMUM_LENGTH' )) {
|
|
|
|
|
|
define( 'PPP_MAXIMUM_LENGTH', 20 );
|
2010-12-02 23:34:41 +00:00
|
|
|
|
}
|
2012-10-19 10:24:29 -04:00
|
|
|
|
if (! defined( 'PPP_NUMERICAL_CHARACTER_REQUIRED' )) {
|
|
|
|
|
|
define( 'PPP_NUMERICAL_CHARACTER_REQUIRED', 0 );
|
|
|
|
|
|
}
|
|
|
|
|
|
if (! defined( 'PPP_UPPERCASE_CHARACTER_REQUIRED' )) {
|
|
|
|
|
|
define( 'PPP_UPPERCASE_CHARACTER_REQUIRED', 0 );
|
|
|
|
|
|
}
|
|
|
|
|
|
if (! defined( 'PPP_SPECIAL_CHARACTER_REQUIRED' )) {
|
|
|
|
|
|
define( 'PPP_SPECIAL_CHARACTER_REQUIRED', 0 );
|
|
|
|
|
|
}
|
|
|
|
|
|
if (! defined( 'PPP_EXPIRATION_IN' )) {
|
|
|
|
|
|
define( 'PPP_EXPIRATION_IN', 0 );
|
|
|
|
|
|
}
|
|
|
|
|
|
if (function_exists( 'mb_strlen' )) {
|
|
|
|
|
|
$iLength = mb_strlen( $sPassword );
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$iLength = strlen( $sPassword );
|
|
|
|
|
|
}
|
|
|
|
|
|
$aErrors = array ();
|
2014-06-12 16:02:32 -04:00
|
|
|
|
if ($iLength < PPP_MINIMUM_LENGTH || $nowLogin) {
|
2012-10-19 10:24:29 -04:00
|
|
|
|
$aErrors[] = 'ID_PPP_MINIMUM_LENGTH';
|
|
|
|
|
|
}
|
2014-06-12 16:02:32 -04:00
|
|
|
|
if ($iLength > PPP_MAXIMUM_LENGTH || $nowLogin) {
|
2012-10-19 10:24:29 -04:00
|
|
|
|
$aErrors[] = 'ID_PPP_MAXIMUM_LENGTH';
|
|
|
|
|
|
}
|
|
|
|
|
|
if (PPP_NUMERICAL_CHARACTER_REQUIRED == 1) {
|
2014-06-17 12:06:22 -04:00
|
|
|
|
if (preg_match_all( '/[0-9]/', $sPassword, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE ) == 0 || $nowLogin) {
|
2012-10-19 10:24:29 -04:00
|
|
|
|
$aErrors[] = 'ID_PPP_NUMERICAL_CHARACTER_REQUIRED';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (PPP_UPPERCASE_CHARACTER_REQUIRED == 1) {
|
2014-06-17 12:06:22 -04:00
|
|
|
|
if (preg_match_all( '/[A-Z]/', $sPassword, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE ) == 0 || $nowLogin) {
|
2012-10-19 10:24:29 -04:00
|
|
|
|
$aErrors[] = 'ID_PPP_UPPERCASE_CHARACTER_REQUIRED';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (PPP_SPECIAL_CHARACTER_REQUIRED == 1) {
|
2014-06-17 12:06:22 -04:00
|
|
|
|
if (preg_match_all( '/[<5B><>\\!|"@<40>#$~%<25>&<26>\/()=\'?<3F><>*+\-_.:,;]/', $sPassword, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE ) == 0 || $nowLogin) {
|
2012-10-19 10:24:29 -04:00
|
|
|
|
$aErrors[] = 'ID_PPP_SPECIAL_CHARACTER_REQUIRED';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (PPP_EXPIRATION_IN > 0) {
|
2017-08-04 10:13:09 -04:00
|
|
|
|
$oCalendar = new Calendar();
|
2013-11-26 17:36:40 -04:00
|
|
|
|
|
2014-05-16 16:20:15 -04:00
|
|
|
|
if ($oCalendar->pmCalendarUid == '') {
|
|
|
|
|
|
$oCalendar->pmCalendarUid = '00000000000000000000000000000001';
|
|
|
|
|
|
$oCalendar->getCalendarData();
|
2013-11-26 17:36:40 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$fDays = $oCalendar->calculateDuration( date( 'Y-m-d H:i:s' ), $sLastUpdate );
|
2014-06-12 16:02:32 -04:00
|
|
|
|
if ($fDays > (PPP_EXPIRATION_IN * 24) || $nowLogin) {
|
2012-10-19 10:24:29 -04:00
|
|
|
|
$aErrors[] = 'ID_PPP_EXPIRATION_IN';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-05-16 16:20:15 -04:00
|
|
|
|
if ($iChangePasswordNextTime == 1) {
|
|
|
|
|
|
$aErrors[] = 'ID_PPP_CHANGE_PASSWORD_AFTER_NEXT_LOGIN';
|
2012-10-19 10:24:29 -04:00
|
|
|
|
}
|
|
|
|
|
|
return $aErrors;
|
2010-12-02 23:34:41 +00:00
|
|
|
|
}
|
2012-04-05 12:52:33 -04:00
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
/**
|
|
|
|
|
|
* get user location
|
|
|
|
|
|
* defined by precedence plugin->ux->default
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function redirectTo ($usrID, $lang = '')
|
|
|
|
|
|
{
|
|
|
|
|
|
$this->usrID = $usrID;
|
|
|
|
|
|
$this->lang = empty( $lang ) ? $this->lang : $lang;
|
2010-12-02 23:34:41 +00:00
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
$url = $this->_getPluginLocation();
|
2012-09-25 17:33:17 -04:00
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
if (empty( $url )) {
|
|
|
|
|
|
$url = $this->_getUXLocation();
|
|
|
|
|
|
}
|
2012-04-05 12:52:33 -04:00
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
$urlUx = $this->_getUXSkinVariant();
|
|
|
|
|
|
if (empty( $url ) && ! empty( $urlUx )) {
|
|
|
|
|
|
$_SESSION['_defaultUserLocation'] = $url;
|
|
|
|
|
|
$url = $urlUx;
|
|
|
|
|
|
}
|
2012-04-05 12:52:33 -04:00
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
if (empty( $url )) {
|
|
|
|
|
|
$url = $this->_getDefaultLocation();
|
|
|
|
|
|
}
|
2012-04-05 12:52:33 -04:00
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
return $url;
|
2012-04-05 12:52:33 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
/**
|
|
|
|
|
|
* get user location
|
|
|
|
|
|
* defined by precedence plugin->default
|
|
|
|
|
|
* note that is getting location without User Inbox Simplified varification
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function getUserLocation ($usrID, $lang = 'en')
|
|
|
|
|
|
{
|
|
|
|
|
|
$this->usrID = $usrID;
|
|
|
|
|
|
$this->lang = empty( $lang ) ? $this->lang : $lang;
|
2012-04-05 12:52:33 -04:00
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
$url = $this->_getPluginLocation();
|
2012-09-25 17:33:17 -04:00
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
if (empty( $url )) {
|
|
|
|
|
|
$url = $this->_getDefaultLocation();
|
|
|
|
|
|
}
|
2012-04-05 12:52:33 -04:00
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
$urlUx = $this->_getUXSkinVariant();
|
|
|
|
|
|
if (! empty( $urlUx )) {
|
|
|
|
|
|
$_SESSION['_defaultUserLocation'] = $url;
|
|
|
|
|
|
$url = $urlUx;
|
|
|
|
|
|
}
|
2012-04-05 12:52:33 -04:00
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
return $url;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* to verify if the user is using some "ux..." skin variant
|
|
|
|
|
|
* if that is the case, the redirection will change to 'main' controller
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function _getUXSkinVariant ()
|
|
|
|
|
|
{
|
|
|
|
|
|
$url = '';
|
|
|
|
|
|
|
|
|
|
|
|
if (substr( SYS_SKIN, 0, 2 ) == 'ux' && SYS_SKIN != 'uxs') {
|
2012-12-14 11:43:43 -04:00
|
|
|
|
if (isset($_COOKIE['workspaceSkin'])) {
|
|
|
|
|
|
if (substr( $_COOKIE['workspaceSkin'], 0, 2 ) != 'ux') {
|
|
|
|
|
|
$url = $this->_getDefaultLocation();
|
|
|
|
|
|
return $url;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/main';
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/main';
|
|
|
|
|
|
}
|
2012-10-19 10:24:29 -04:00
|
|
|
|
global $RBAC;
|
|
|
|
|
|
$oConf = new Configurations();
|
|
|
|
|
|
$oConf->loadConfig( $x, 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'], '' );
|
|
|
|
|
|
if (sizeof( $oConf->aConfig ) > 0) {
|
|
|
|
|
|
if ($oConf->aConfig['DEFAULT_MENU'] == 'PM_USERS') {
|
|
|
|
|
|
$oConf->aConfig['DEFAULT_MENU'] = 'PM_SETUP';
|
|
|
|
|
|
}
|
2012-04-05 12:52:33 -04:00
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
$getUrl = null;
|
|
|
|
|
|
|
|
|
|
|
|
switch ($oConf->aConfig['DEFAULT_MENU']) {
|
|
|
|
|
|
case 'PM_SETUP':
|
|
|
|
|
|
if ($RBAC->userCanAccess( 'PM_SETUP' ) == 1) {
|
|
|
|
|
|
$getUrl = 'admin';
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'PM_FACTORY':
|
|
|
|
|
|
if ($RBAC->userCanAccess( 'PM_FACTORY' ) == 1) {
|
|
|
|
|
|
$getUrl = 'designer';
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'PM_CASES':
|
|
|
|
|
|
if ($RBAC->userCanAccess( 'PM_CASES' ) == 1) {
|
|
|
|
|
|
$getUrl = 'home';
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'PM_USERS':
|
|
|
|
|
|
if ($RBAC->userCanAccess( 'PM_USERS' ) == 1) {
|
|
|
|
|
|
$getUrl = 'admin';
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'PM_DASHBOARD':
|
|
|
|
|
|
if ($RBAC->userCanAccess( 'PM_DASHBOARD' ) == 1) {
|
|
|
|
|
|
$getUrl = 'dashboard';
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$url = $url . (($getUrl != null) ? "?st=" . $getUrl : null);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return $url;
|
2012-04-05 12:52:33 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
/**
|
|
|
|
|
|
* get the plugins, and check if there is redirectLogins
|
|
|
|
|
|
* if yes, then redirect goes according his Role
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function _getPluginLocation ()
|
|
|
|
|
|
{
|
|
|
|
|
|
global $RBAC;
|
|
|
|
|
|
$url = '';
|
|
|
|
|
|
|
|
|
|
|
|
if (class_exists( 'redirectDetail' )) {
|
|
|
|
|
|
//to do: complete the validation
|
|
|
|
|
|
if (isset( $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'] )) {
|
|
|
|
|
|
$userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-08-01 12:16:06 -04:00
|
|
|
|
$oPluginRegistry = PluginRegistry::loadSingleton();
|
2012-10-19 10:24:29 -04:00
|
|
|
|
$aRedirectLogin = $oPluginRegistry->getRedirectLogins();
|
|
|
|
|
|
if (isset( $aRedirectLogin ) && is_array( $aRedirectLogin )) {
|
|
|
|
|
|
foreach ($aRedirectLogin as $key => $detail) {
|
|
|
|
|
|
if (isset( $detail->sPathMethod ) && $detail->sRoleCode == $userRole) {
|
2012-12-14 11:43:43 -04:00
|
|
|
|
if (isset($_COOKIE['workspaceSkin'])) {
|
|
|
|
|
|
$url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/' . $detail->sPathMethod;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/' . $detail->sPathMethod;
|
|
|
|
|
|
}
|
2012-10-19 10:24:29 -04:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return $url;
|
2012-04-05 12:52:33 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
/**
|
|
|
|
|
|
* New feature - User Experience Redirector
|
|
|
|
|
|
*
|
|
|
|
|
|
* @author Erik Amaru Ortiz <erik@colosa.com>
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function _getUXLocation ()
|
|
|
|
|
|
{
|
|
|
|
|
|
require_once 'classes/model/Users.php';
|
|
|
|
|
|
$u = UsersPeer::retrieveByPK( $this->usrID );
|
|
|
|
|
|
$url = '';
|
|
|
|
|
|
|
|
|
|
|
|
$uxType = $u->getUsrUx();
|
|
|
|
|
|
$_SESSION['user_experience'] = 'NORMAL';
|
|
|
|
|
|
|
|
|
|
|
|
// find a group setting
|
|
|
|
|
|
if ($uxType == '' || $uxType == 'NORMAL') {
|
|
|
|
|
|
require_once 'classes/model/GroupUser.php';
|
|
|
|
|
|
$gu = new GroupUser();
|
|
|
|
|
|
$ugList = $gu->getAllUserGroups( $this->usrID );
|
2012-04-05 12:52:33 -04:00
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
foreach ($ugList as $row) {
|
|
|
|
|
|
if ($row['GRP_UX'] != 'NORMAL' && $row['GRP_UX'] != '') {
|
|
|
|
|
|
$uxType = $row['GRP_UX'];
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch ($uxType) {
|
|
|
|
|
|
case 'SIMPLIFIED':
|
|
|
|
|
|
case 'SWITCHABLE':
|
|
|
|
|
|
case 'SINGLE':
|
|
|
|
|
|
$_SESSION['user_experience'] = $uxType;
|
|
|
|
|
|
$_SESSION['user_last_skin'] = SYS_SKIN;
|
|
|
|
|
|
$url = '/sys' . SYS_SYS . '/' . $this->lang . '/uxs/' . 'home';
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2012-04-05 12:52:33 -04:00
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
return $url;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* get user preferences for default redirect
|
|
|
|
|
|
* verifying if it has any preferences on configurations table
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function _getDefaultLocation ()
|
|
|
|
|
|
{
|
2012-09-13 14:17:39 -04:00
|
|
|
|
global $RBAC;
|
2012-10-19 10:24:29 -04:00
|
|
|
|
$oConf = new Configurations();
|
|
|
|
|
|
$oConf->loadConfig( $x, 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'], '' );
|
|
|
|
|
|
|
2012-12-14 11:43:43 -04:00
|
|
|
|
//$baseUrl = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/';
|
|
|
|
|
|
if (isset($_COOKIE['workspaceSkin'])) {
|
|
|
|
|
|
$baseUrl = '/sys' . SYS_SYS . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/';
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$baseUrl = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/';
|
|
|
|
|
|
}
|
2012-10-19 10:24:29 -04:00
|
|
|
|
$url = '';
|
|
|
|
|
|
|
|
|
|
|
|
if (sizeof( $oConf->aConfig ) > 0) {
|
|
|
|
|
|
// this user has a configuration record
|
|
|
|
|
|
// backward compatibility, because now, we don't have user and dashboard menu.
|
2012-09-13 14:17:39 -04:00
|
|
|
|
if ($oConf->aConfig['DEFAULT_MENU'] == 'PM_USERS') {
|
|
|
|
|
|
$oConf->aConfig['DEFAULT_MENU'] = 'PM_SETUP';
|
|
|
|
|
|
}
|
2012-09-25 17:33:17 -04:00
|
|
|
|
|
2012-09-13 14:17:39 -04:00
|
|
|
|
switch ($oConf->aConfig['DEFAULT_MENU']) {
|
|
|
|
|
|
case 'PM_SETUP':
|
2016-09-14 18:02:12 -04:00
|
|
|
|
if ($RBAC->userCanAccess( 'PM_SETUP' ) == 1 || $RBAC->userCanAccess('PM_USERS') == 1) {
|
2012-10-19 10:24:29 -04:00
|
|
|
|
$url = 'setup/main';
|
2012-09-13 14:17:39 -04:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'PM_FACTORY':
|
2012-10-19 10:24:29 -04:00
|
|
|
|
if ($RBAC->userCanAccess( 'PM_FACTORY' ) == 1) {
|
|
|
|
|
|
$url = 'processes/main';
|
2012-09-13 14:17:39 -04:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'PM_CASES':
|
2012-10-19 10:24:29 -04:00
|
|
|
|
if ($RBAC->userCanAccess( 'PM_CASES' ) == 1) {
|
|
|
|
|
|
$url = 'cases/main';
|
2012-09-13 14:17:39 -04:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'PM_USERS':
|
2012-10-19 10:24:29 -04:00
|
|
|
|
if ($RBAC->userCanAccess( 'PM_USERS' ) == 1) {
|
|
|
|
|
|
$url = 'setup/main';
|
2012-09-13 14:17:39 -04:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'PM_DASHBOARD':
|
2012-10-19 10:24:29 -04:00
|
|
|
|
if ($RBAC->userCanAccess( 'PM_DASHBOARD' ) == 1) {
|
|
|
|
|
|
$url = 'dashboard/main';
|
2012-09-13 14:17:39 -04:00
|
|
|
|
}
|
|
|
|
|
|
break;
|
2015-04-06 11:45:30 -04:00
|
|
|
|
/*----------------------------------********---------------------------------*/
|
2015-04-06 11:35:09 -04:00
|
|
|
|
case 'PM_STRATEGIC_DASHBOARD':
|
|
|
|
|
|
$licensedFeatures = & PMLicensedFeatures::getSingleton();
|
|
|
|
|
|
if ($licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjBsZEJ6dnpJa3dTeWVLVT0=') && $RBAC->userCanAccess( 'PM_SETUP' ) == 1) {
|
|
|
|
|
|
$url = 'strategicDashboard/main';
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
2015-04-06 11:45:30 -04:00
|
|
|
|
/*----------------------------------********---------------------------------*/
|
2012-09-13 14:17:39 -04:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2012-09-25 17:33:17 -04:00
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
if (empty( $url )) {
|
|
|
|
|
|
if ($RBAC->userCanAccess( 'PM_FACTORY' ) == 1) {
|
|
|
|
|
|
$url = 'processes/main';
|
|
|
|
|
|
} elseif ($RBAC->userCanAccess( 'PM_SETUP' ) == 1) {
|
|
|
|
|
|
$url = 'setup/main';
|
|
|
|
|
|
} elseif ($RBAC->userCanAccess( 'PM_CASES' ) == 1) {
|
|
|
|
|
|
$url = 'cases/main';
|
|
|
|
|
|
} elseif ($RBAC->userCanAccess( 'PM_USERS' ) == 1) {
|
|
|
|
|
|
$url = 'setup/main';
|
|
|
|
|
|
} elseif ($RBAC->userCanAccess( 'PM_DASHBOARD' ) == 1) {
|
|
|
|
|
|
$url = 'dashboard/dashboard';
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$url = 'users/myInfo';
|
|
|
|
|
|
}
|
2012-09-13 14:17:39 -04:00
|
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
|
|
2012-10-19 10:24:29 -04:00
|
|
|
|
return $baseUrl . $url;
|
2010-12-02 23:34:41 +00:00
|
|
|
|
}
|
2012-10-19 10:24:29 -04:00
|
|
|
|
}
|
2012-04-05 12:52:33 -04:00
|
|
|
|
|