HOR-1019 "Add option to force the ABE user to login..." SOLVED

Issue:
    Add option to force the ABE user to login in ProcessMaker before executing Action
Cause:
    Nuevo requerimiento
Solution:
    Se implemento la opcion "Force user login" (Back-end y Front-end)
This commit is contained in:
Victor Saisa Lopez
2016-05-19 14:52:24 -04:00
parent dc0658e90a
commit 41c13dae23
15 changed files with 612 additions and 218 deletions

View File

@@ -16,9 +16,24 @@ require_once 'classes/model/om/BaseAbeConfiguration.php';
class AbeConfiguration extends BaseAbeConfiguration
{
private $filterThisFields = array('ABE_UID', 'PRO_UID', 'TAS_UID', 'ABE_TYPE',
'ABE_TEMPLATE', 'ABE_DYN_TYPE', 'DYN_UID','ABE_EMAIL_FIELD',
'ABE_ACTION_FIELD', 'ABE_CASE_NOTE_IN_RESPONSE', 'ABE_CREATE_DATE','ABE_UPDATE_DATE','ABE_MAILSERVER_OR_MAILCURRENT','ABE_SUBJECT_FIELD','ABE_CUSTOM_GRID');
private $filterThisFields = [
'ABE_UID',
'PRO_UID',
'TAS_UID',
'ABE_TYPE',
'ABE_TEMPLATE',
'ABE_DYN_TYPE',
'DYN_UID',
'ABE_EMAIL_FIELD',
'ABE_ACTION_FIELD',
'ABE_CASE_NOTE_IN_RESPONSE',
'ABE_FORCE_LOGIN',
'ABE_CREATE_DATE',
'ABE_UPDATE_DATE',
'ABE_SUBJECT_FIELD',
'ABE_MAILSERVER_OR_MAILCURRENT',
'ABE_CUSTOM_GRID'
];
public function load($abeUid)
{

View File

@@ -85,6 +85,8 @@ class AbeConfigurationMapBuilder
$tMap->addColumn('ABE_CASE_NOTE_IN_RESPONSE', 'AbeCaseNoteInResponse', 'int', CreoleTypes::INTEGER, false, null);
$tMap->addColumn('ABE_FORCE_LOGIN', 'AbeForceLogin', 'int', CreoleTypes::INTEGER, false, null);
$tMap->addColumn('ABE_CREATE_DATE', 'AbeCreateDate', 'int', CreoleTypes::TIMESTAMP, true, null);
$tMap->addColumn('ABE_UPDATE_DATE', 'AbeUpdateDate', 'int', CreoleTypes::TIMESTAMP, false, null);

View File

@@ -87,6 +87,12 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent
*/
protected $abe_case_note_in_response = 0;
/**
* The value for the abe_force_login field.
* @var int
*/
protected $abe_force_login = 0;
/**
* The value for the abe_create_date field.
* @var int
@@ -241,6 +247,17 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent
return $this->abe_case_note_in_response;
}
/**
* Get the [abe_force_login] column value.
*
* @return int
*/
public function getAbeForceLogin()
{
return $this->abe_force_login;
}
/**
* Get the [optionally formatted] [abe_create_date] column value.
*
@@ -558,6 +575,28 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent
} // setAbeCaseNoteInResponse()
/**
* Set the value of [abe_force_login] column.
*
* @param int $v new value
* @return void
*/
public function setAbeForceLogin($v)
{
// Since the native PHP type for this column is integer,
// we will cast the input value to an int (if it is not).
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
}
if ($this->abe_force_login !== $v || $v === 0) {
$this->abe_force_login = $v;
$this->modifiedColumns[] = AbeConfigurationPeer::ABE_FORCE_LOGIN;
}
} // setAbeForceLogin()
/**
* Set the value of [abe_create_date] column.
*
@@ -719,22 +758,24 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent
$this->abe_case_note_in_response = $rs->getInt($startcol + 9);
$this->abe_create_date = $rs->getTimestamp($startcol + 10, null);
$this->abe_force_login = $rs->getInt($startcol + 10);
$this->abe_update_date = $rs->getTimestamp($startcol + 11, null);
$this->abe_create_date = $rs->getTimestamp($startcol + 11, null);
$this->abe_subject_field = $rs->getString($startcol + 12);
$this->abe_update_date = $rs->getTimestamp($startcol + 12, null);
$this->abe_mailserver_or_mailcurrent = $rs->getInt($startcol + 13);
$this->abe_subject_field = $rs->getString($startcol + 13);
$this->abe_custom_grid = $rs->getString($startcol + 14);
$this->abe_mailserver_or_mailcurrent = $rs->getInt($startcol + 14);
$this->abe_custom_grid = $rs->getString($startcol + 15);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 15; // 15 = AbeConfigurationPeer::NUM_COLUMNS - AbeConfigurationPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 16; // 16 = AbeConfigurationPeer::NUM_COLUMNS - AbeConfigurationPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating AbeConfiguration object", $e);
@@ -969,18 +1010,21 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent
return $this->getAbeCaseNoteInResponse();
break;
case 10:
return $this->getAbeCreateDate();
return $this->getAbeForceLogin();
break;
case 11:
return $this->getAbeUpdateDate();
return $this->getAbeCreateDate();
break;
case 12:
return $this->getAbeSubjectField();
return $this->getAbeUpdateDate();
break;
case 13:
return $this->getAbeMailserverOrMailcurrent();
return $this->getAbeSubjectField();
break;
case 14:
return $this->getAbeMailserverOrMailcurrent();
break;
case 15:
return $this->getAbeCustomGrid();
break;
default:
@@ -1013,11 +1057,12 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent
$keys[7] => $this->getAbeEmailField(),
$keys[8] => $this->getAbeActionField(),
$keys[9] => $this->getAbeCaseNoteInResponse(),
$keys[10] => $this->getAbeCreateDate(),
$keys[11] => $this->getAbeUpdateDate(),
$keys[12] => $this->getAbeSubjectField(),
$keys[13] => $this->getAbeMailserverOrMailcurrent(),
$keys[14] => $this->getAbeCustomGrid(),
$keys[10] => $this->getAbeForceLogin(),
$keys[11] => $this->getAbeCreateDate(),
$keys[12] => $this->getAbeUpdateDate(),
$keys[13] => $this->getAbeSubjectField(),
$keys[14] => $this->getAbeMailserverOrMailcurrent(),
$keys[15] => $this->getAbeCustomGrid(),
);
return $result;
}
@@ -1080,18 +1125,21 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent
$this->setAbeCaseNoteInResponse($value);
break;
case 10:
$this->setAbeCreateDate($value);
$this->setAbeForceLogin($value);
break;
case 11:
$this->setAbeUpdateDate($value);
$this->setAbeCreateDate($value);
break;
case 12:
$this->setAbeSubjectField($value);
$this->setAbeUpdateDate($value);
break;
case 13:
$this->setAbeMailserverOrMailcurrent($value);
$this->setAbeSubjectField($value);
break;
case 14:
$this->setAbeMailserverOrMailcurrent($value);
break;
case 15:
$this->setAbeCustomGrid($value);
break;
} // switch()
@@ -1158,23 +1206,27 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent
}
if (array_key_exists($keys[10], $arr)) {
$this->setAbeCreateDate($arr[$keys[10]]);
$this->setAbeForceLogin($arr[$keys[10]]);
}
if (array_key_exists($keys[11], $arr)) {
$this->setAbeUpdateDate($arr[$keys[11]]);
$this->setAbeCreateDate($arr[$keys[11]]);
}
if (array_key_exists($keys[12], $arr)) {
$this->setAbeSubjectField($arr[$keys[12]]);
$this->setAbeUpdateDate($arr[$keys[12]]);
}
if (array_key_exists($keys[13], $arr)) {
$this->setAbeMailserverOrMailcurrent($arr[$keys[13]]);
$this->setAbeSubjectField($arr[$keys[13]]);
}
if (array_key_exists($keys[14], $arr)) {
$this->setAbeCustomGrid($arr[$keys[14]]);
$this->setAbeMailserverOrMailcurrent($arr[$keys[14]]);
}
if (array_key_exists($keys[15], $arr)) {
$this->setAbeCustomGrid($arr[$keys[15]]);
}
}
@@ -1228,6 +1280,10 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent
$criteria->add(AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE, $this->abe_case_note_in_response);
}
if ($this->isColumnModified(AbeConfigurationPeer::ABE_FORCE_LOGIN)) {
$criteria->add(AbeConfigurationPeer::ABE_FORCE_LOGIN, $this->abe_force_login);
}
if ($this->isColumnModified(AbeConfigurationPeer::ABE_CREATE_DATE)) {
$criteria->add(AbeConfigurationPeer::ABE_CREATE_DATE, $this->abe_create_date);
}
@@ -1320,6 +1376,8 @@ abstract class BaseAbeConfiguration extends BaseObject implements Persistent
$copyObj->setAbeCaseNoteInResponse($this->abe_case_note_in_response);
$copyObj->setAbeForceLogin($this->abe_force_login);
$copyObj->setAbeCreateDate($this->abe_create_date);
$copyObj->setAbeUpdateDate($this->abe_update_date);

View File

@@ -25,7 +25,7 @@ abstract class BaseAbeConfigurationPeer
const CLASS_DEFAULT = 'classes.model.AbeConfiguration';
/** The total number of columns. */
const NUM_COLUMNS = 15;
const NUM_COLUMNS = 16;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -61,6 +61,9 @@ abstract class BaseAbeConfigurationPeer
/** the column name for the ABE_CASE_NOTE_IN_RESPONSE field */
const ABE_CASE_NOTE_IN_RESPONSE = 'ABE_CONFIGURATION.ABE_CASE_NOTE_IN_RESPONSE';
/** the column name for the ABE_FORCE_LOGIN field */
const ABE_FORCE_LOGIN = 'ABE_CONFIGURATION.ABE_FORCE_LOGIN';
/** the column name for the ABE_CREATE_DATE field */
const ABE_CREATE_DATE = 'ABE_CONFIGURATION.ABE_CREATE_DATE';
@@ -87,10 +90,10 @@ abstract class BaseAbeConfigurationPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('AbeUid', 'ProUid', 'TasUid', 'AbeType', 'AbeTemplate', 'AbeDynType', 'DynUid', 'AbeEmailField', 'AbeActionField', 'AbeCaseNoteInResponse', 'AbeCreateDate', 'AbeUpdateDate', 'AbeSubjectField', 'AbeMailserverOrMailcurrent', 'AbeCustomGrid', ),
BasePeer::TYPE_COLNAME => array (AbeConfigurationPeer::ABE_UID, AbeConfigurationPeer::PRO_UID, AbeConfigurationPeer::TAS_UID, AbeConfigurationPeer::ABE_TYPE, AbeConfigurationPeer::ABE_TEMPLATE, AbeConfigurationPeer::ABE_DYN_TYPE, AbeConfigurationPeer::DYN_UID, AbeConfigurationPeer::ABE_EMAIL_FIELD, AbeConfigurationPeer::ABE_ACTION_FIELD, AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE, AbeConfigurationPeer::ABE_CREATE_DATE, AbeConfigurationPeer::ABE_UPDATE_DATE, AbeConfigurationPeer::ABE_SUBJECT_FIELD, AbeConfigurationPeer::ABE_MAILSERVER_OR_MAILCURRENT, AbeConfigurationPeer::ABE_CUSTOM_GRID, ),
BasePeer::TYPE_FIELDNAME => array ('ABE_UID', 'PRO_UID', 'TAS_UID', 'ABE_TYPE', 'ABE_TEMPLATE', 'ABE_DYN_TYPE', 'DYN_UID', 'ABE_EMAIL_FIELD', 'ABE_ACTION_FIELD', 'ABE_CASE_NOTE_IN_RESPONSE', 'ABE_CREATE_DATE', 'ABE_UPDATE_DATE', 'ABE_SUBJECT_FIELD', 'ABE_MAILSERVER_OR_MAILCURRENT', 'ABE_CUSTOM_GRID', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
BasePeer::TYPE_PHPNAME => array ('AbeUid', 'ProUid', 'TasUid', 'AbeType', 'AbeTemplate', 'AbeDynType', 'DynUid', 'AbeEmailField', 'AbeActionField', 'AbeCaseNoteInResponse', 'AbeForceLogin', 'AbeCreateDate', 'AbeUpdateDate', 'AbeSubjectField', 'AbeMailserverOrMailcurrent', 'AbeCustomGrid', ),
BasePeer::TYPE_COLNAME => array (AbeConfigurationPeer::ABE_UID, AbeConfigurationPeer::PRO_UID, AbeConfigurationPeer::TAS_UID, AbeConfigurationPeer::ABE_TYPE, AbeConfigurationPeer::ABE_TEMPLATE, AbeConfigurationPeer::ABE_DYN_TYPE, AbeConfigurationPeer::DYN_UID, AbeConfigurationPeer::ABE_EMAIL_FIELD, AbeConfigurationPeer::ABE_ACTION_FIELD, AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE, AbeConfigurationPeer::ABE_FORCE_LOGIN, AbeConfigurationPeer::ABE_CREATE_DATE, AbeConfigurationPeer::ABE_UPDATE_DATE, AbeConfigurationPeer::ABE_SUBJECT_FIELD, AbeConfigurationPeer::ABE_MAILSERVER_OR_MAILCURRENT, AbeConfigurationPeer::ABE_CUSTOM_GRID, ),
BasePeer::TYPE_FIELDNAME => array ('ABE_UID', 'PRO_UID', 'TAS_UID', 'ABE_TYPE', 'ABE_TEMPLATE', 'ABE_DYN_TYPE', 'DYN_UID', 'ABE_EMAIL_FIELD', 'ABE_ACTION_FIELD', 'ABE_CASE_NOTE_IN_RESPONSE', 'ABE_FORCE_LOGIN', 'ABE_CREATE_DATE', 'ABE_UPDATE_DATE', 'ABE_SUBJECT_FIELD', 'ABE_MAILSERVER_OR_MAILCURRENT', 'ABE_CUSTOM_GRID', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
);
/**
@@ -100,10 +103,10 @@ abstract class BaseAbeConfigurationPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('AbeUid' => 0, 'ProUid' => 1, 'TasUid' => 2, 'AbeType' => 3, 'AbeTemplate' => 4, 'AbeDynType' => 5, 'DynUid' => 6, 'AbeEmailField' => 7, 'AbeActionField' => 8, 'AbeCaseNoteInResponse' => 9, 'AbeCreateDate' => 10, 'AbeUpdateDate' => 11, 'AbeSubjectField' => 12, 'AbeMailserverOrMailcurrent' => 13, 'AbeCustomGrid' => 14, ),
BasePeer::TYPE_COLNAME => array (AbeConfigurationPeer::ABE_UID => 0, AbeConfigurationPeer::PRO_UID => 1, AbeConfigurationPeer::TAS_UID => 2, AbeConfigurationPeer::ABE_TYPE => 3, AbeConfigurationPeer::ABE_TEMPLATE => 4, AbeConfigurationPeer::ABE_DYN_TYPE => 5, AbeConfigurationPeer::DYN_UID => 6, AbeConfigurationPeer::ABE_EMAIL_FIELD => 7, AbeConfigurationPeer::ABE_ACTION_FIELD => 8, AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE => 9, AbeConfigurationPeer::ABE_CREATE_DATE => 10, AbeConfigurationPeer::ABE_UPDATE_DATE => 11, AbeConfigurationPeer::ABE_SUBJECT_FIELD => 12, AbeConfigurationPeer::ABE_MAILSERVER_OR_MAILCURRENT => 13, AbeConfigurationPeer::ABE_CUSTOM_GRID => 14, ),
BasePeer::TYPE_FIELDNAME => array ('ABE_UID' => 0, 'PRO_UID' => 1, 'TAS_UID' => 2, 'ABE_TYPE' => 3, 'ABE_TEMPLATE' => 4, 'ABE_DYN_TYPE' => 5, 'DYN_UID' => 6, 'ABE_EMAIL_FIELD' => 7, 'ABE_ACTION_FIELD' => 8, 'ABE_CASE_NOTE_IN_RESPONSE' => 9, 'ABE_CREATE_DATE' => 10, 'ABE_UPDATE_DATE' => 11, 'ABE_SUBJECT_FIELD' => 12, 'ABE_MAILSERVER_OR_MAILCURRENT' => 13, 'ABE_CUSTOM_GRID' => 14, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, )
BasePeer::TYPE_PHPNAME => array ('AbeUid' => 0, 'ProUid' => 1, 'TasUid' => 2, 'AbeType' => 3, 'AbeTemplate' => 4, 'AbeDynType' => 5, 'DynUid' => 6, 'AbeEmailField' => 7, 'AbeActionField' => 8, 'AbeCaseNoteInResponse' => 9, 'AbeForceLogin' => 10, 'AbeCreateDate' => 11, 'AbeUpdateDate' => 12, 'AbeSubjectField' => 13, 'AbeMailserverOrMailcurrent' => 14, 'AbeCustomGrid' => 15, ),
BasePeer::TYPE_COLNAME => array (AbeConfigurationPeer::ABE_UID => 0, AbeConfigurationPeer::PRO_UID => 1, AbeConfigurationPeer::TAS_UID => 2, AbeConfigurationPeer::ABE_TYPE => 3, AbeConfigurationPeer::ABE_TEMPLATE => 4, AbeConfigurationPeer::ABE_DYN_TYPE => 5, AbeConfigurationPeer::DYN_UID => 6, AbeConfigurationPeer::ABE_EMAIL_FIELD => 7, AbeConfigurationPeer::ABE_ACTION_FIELD => 8, AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE => 9, AbeConfigurationPeer::ABE_FORCE_LOGIN => 10, AbeConfigurationPeer::ABE_CREATE_DATE => 11, AbeConfigurationPeer::ABE_UPDATE_DATE => 12, AbeConfigurationPeer::ABE_SUBJECT_FIELD => 13, AbeConfigurationPeer::ABE_MAILSERVER_OR_MAILCURRENT => 14, AbeConfigurationPeer::ABE_CUSTOM_GRID => 15, ),
BasePeer::TYPE_FIELDNAME => array ('ABE_UID' => 0, 'PRO_UID' => 1, 'TAS_UID' => 2, 'ABE_TYPE' => 3, 'ABE_TEMPLATE' => 4, 'ABE_DYN_TYPE' => 5, 'DYN_UID' => 6, 'ABE_EMAIL_FIELD' => 7, 'ABE_ACTION_FIELD' => 8, 'ABE_CASE_NOTE_IN_RESPONSE' => 9, 'ABE_FORCE_LOGIN' => 10, 'ABE_CREATE_DATE' => 11, 'ABE_UPDATE_DATE' => 12, 'ABE_SUBJECT_FIELD' => 13, 'ABE_MAILSERVER_OR_MAILCURRENT' => 14, 'ABE_CUSTOM_GRID' => 15, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, )
);
/**
@@ -224,6 +227,8 @@ abstract class BaseAbeConfigurationPeer
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_CASE_NOTE_IN_RESPONSE);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_FORCE_LOGIN);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_CREATE_DATE);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_UPDATE_DATE);

View File

@@ -4726,16 +4726,8 @@
<parameter name="Extra" value=""/>
</vendor>
</column>
<column name="ABE_CASE_NOTE_IN_RESPONSE" type="INTEGER" required="false" default="0">
<vendor type="mysql">
<parameter name="Field" value="ABE_CASE_NOTE_IN_RESPONSE"/>
<parameter name="Type" value="int(1)"/>
<parameter name="Null" value="YES"/>
<parameter name="Key" value=""/>
<parameter name="Default" value="0"/>
<parameter name="Extra" value=""/>
</vendor>
</column>
<column name="ABE_CASE_NOTE_IN_RESPONSE" type="INTEGER" default="0" />
<column name="ABE_FORCE_LOGIN" type="INTEGER" default="0" />
<column name="ABE_CREATE_DATE" type="TIMESTAMP" required="true">
<vendor type="mysql">
<parameter name="Field" value="ABE_CREATE_DATE"/>

View File

@@ -2685,6 +2685,7 @@ CREATE TABLE `ABE_CONFIGURATION`
`ABE_EMAIL_FIELD` VARCHAR(255) default '' NOT NULL,
`ABE_ACTION_FIELD` VARCHAR(255) default '',
`ABE_CASE_NOTE_IN_RESPONSE` INTEGER default 0,
`ABE_FORCE_LOGIN` TINYINT default 0,
`ABE_CREATE_DATE` DATETIME NOT NULL,
`ABE_UPDATE_DATE` DATETIME,
`ABE_SUBJECT_FIELD` VARCHAR(100) default '',

View File

@@ -260,7 +260,7 @@ try {
$_SESSION['USR_PASSWORD'] = $pwd;
$_SESSION['BROWSER_TIME_ZONE'] = $dateTime->getTimeZoneIdByTimeZoneOffset((int)($_POST['form']['BROWSER_TIME_ZONE_OFFSET']), false);
$_SESSION['URL'] = (isset($_POST['form']['URL']))? $_POST['form']['URL'] : ((isset($_REQUEST['u']))? $_REQUEST['u'] : '');
$_SESSION['USER_LANG'] = $lang;
if (strpos($_SERVER['HTTP_REFERER'], 'home/login') !== false) {

View File

@@ -0,0 +1,144 @@
<?php
global $G_PUBLISH;
try {
if ($RBAC->singleSignOn) {
$_SESSION['__USER_LOGGED_SSO__'] = $RBAC->userObj->fields['USR_UID'];
$_SESSION['__USR_USERNAME_SSO__'] = $RBAC->userObj->fields['USR_USERNAME'];
} else {
if (!isset($_SESSION['__USER_LOGGED_SSO__'])) {
$u = '';
if (isset($_POST['form']['URL']) && $_POST['form']['URL'] != '') {
$u = $_POST['form']['URL'];
} else {
if (isset($_GET['u']) && $_GET['u'] != '') {
$u = $_GET['u'];
}
}
header(
'Location: /sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN .
'/login/login' . (($u != '')? '?u=' . $u : '')
);
exit(0);
}
}
$userUid = (isset($_SESSION['USER_LOGGED']))? $_SESSION['USER_LOGGED'] : ((isset($_SESSION['__USER_LOGGED_SSO__']))? $_SESSION['__USER_LOGGED_SSO__'] : '');
/*----------------------------------********---------------------------------*/
if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) {
//Update User Time Zone
if (isset($_POST['form']['BROWSER_TIME_ZONE'])) {
$user = new Users();
$user->update(['USR_UID' => $userUid, 'USR_TIME_ZONE' => $_POST['form']['BROWSER_TIME_ZONE']]);
}
}
/*----------------------------------********---------------------------------*/
$arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS);
//Set User Time Zone
$user = UsersPeer::retrieveByPK($userUid);
if (!is_null($user)) {
$userTimeZone = $user->getUsrTimeZone();
if (trim($userTimeZone) == '') {
$userTimeZone = $arraySystemConfiguration['time_zone'];
}
$_SESSION['USR_TIME_ZONE'] = $userTimeZone;
}
//Get default user location
if (isset($_POST['form']['URL']) && $_POST['form']['URL'] != '') {
$location = $_POST['form']['URL'];
} else {
if (isset($_GET['u']) && $_GET['u'] != '') {
$location = $_GET['u'];
} else {
$userProperty = new UsersProperties();
$location = $userProperty->redirectTo($userUid);
}
}
/*----------------------------------********---------------------------------*/
if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) {
if ((int)($arraySystemConfiguration['system_utc_time_zone'])) {
$dateTime = new \ProcessMaker\Util\DateTime();
$timeZoneOffset = $dateTime->getTimeZoneOffsetByTimeZoneId($_SESSION['USR_TIME_ZONE']);
$browserTimeZoneOffset = 0;
if (isset($_POST['form']['BROWSER_TIME_ZONE_OFFSET'])) {
$browserTimeZoneOffset = (int)($_POST['form']['BROWSER_TIME_ZONE_OFFSET']);
} else {
if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) {
$browserTimeZoneOffset = (int)($_GET['BROWSER_TIME_ZONE_OFFSET']);
}
}
if ($timeZoneOffset === false || $timeZoneOffset != $browserTimeZoneOffset) {
$userUtcOffset = $dateTime->getUtcOffsetByTimeZoneOffset($timeZoneOffset);
$browserUtcOffset = $dateTime->getUtcOffsetByTimeZoneOffset($browserTimeZoneOffset);
$arrayTimeZoneId = $dateTime->getTimeZoneIdByTimeZoneOffset($browserTimeZoneOffset);
array_unshift($arrayTimeZoneId, 'false');
array_walk(
$arrayTimeZoneId,
function (&$value, $key, $parameter)
{
$value = ['TZ_UID' => $value, 'TZ_NAME' => '(UTC ' . $parameter . ') ' . $value];
},
$browserUtcOffset
);
$_SESSION['_DBArray'] = ['TIME_ZONE' => $arrayTimeZoneId];
$arrayData = [
'USR_USERNAME' => '',
'USR_PASSWORD' => '',
'USR_TIME_ZONE' => '(UTC ' . $userUtcOffset . ') ' . $_SESSION['USR_TIME_ZONE'],
'BROWSER_TIME_ZONE' => $dateTime->getTimeZoneIdByTimeZoneOffset($browserTimeZoneOffset, false),
'USER_LANG' => SYS_LANG,
'URL' => $location
];
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent(
'xmlform',
'xmlform',
'login' . PATH_SEP . 'TimeZoneAlert',
'',
$arrayData, SYS_URI . 'login/authenticationSso.php'
);
G::RenderPage('publish');
exit(0);
}
}
}
/*----------------------------------********---------------------------------*/
setcookie('singleSignOn', '1', time() + (24 * 60 * 60), '/');
$_SESSION['USER_LOGGED'] = $_SESSION['__USER_LOGGED_SSO__'];
$_SESSION['USR_USERNAME'] = $_SESSION['__USR_USERNAME_SSO__'];
unset($_SESSION['__USER_LOGGED_SSO__'], $_SESSION['__USR_USERNAME_SSO__']);
G::header('Location: ' . $location);
} catch (Exception $e) {
$arrayData = [];
$arrayData['MESSAGE'] = $e->getMessage();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $arrayData);
G::RenderPage('publish');
}

View File

@@ -148,6 +148,8 @@ if (isset($_SESSION['__TIME_ZONE_FAILED__']) && $_SESSION['__TIME_ZONE_FAILED__'
$userPassword = $_SESSION['USR_PASSWORD'];
$userTimeZone = $_SESSION['USR_TIME_ZONE'];
$browserTimeZone = $_SESSION['BROWSER_TIME_ZONE'];
$url = $_SESSION['URL'];
if(isset($_SESSION['USER_LANG'])){
$lang = $_SESSION['USER_LANG'];
}else{
@@ -220,7 +222,8 @@ if ($timeZoneFailed) {
'USR_PASSWORD' => $userPassword,
'USR_TIME_ZONE' => '(UTC ' . $userUtcOffset . ') ' . $userTimeZone,
'BROWSER_TIME_ZONE' => $browserTimeZone,
'USER_LANG' => $lang
'USER_LANG' => $lang,
'URL' => $url
];
$G_PUBLISH = new Publisher();

View File

@@ -1,15 +1,17 @@
<?php
/*----------------------------------********---------------------------------*/
if (PMLicensedFeatures
::getSingleton()
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) {
if (PMLicensedFeatures::getSingleton()->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
// since all the request parameters using this script are encrypted
// using the URL_KEY the probability of injecting any kind of code using
// this entry point are only possible knowing the aforementioned key.
switch (G::decrypt(urldecode(utf8_encode($_REQUEST['ACTION'])), URL_KEY)) {
case 'processABE' :
$G_PUBLISH = new Publisher();
try {
G::LoadClass('case');
//Validations
if (!isset($_REQUEST['APP_UID'])) {
$_REQUEST['APP_UID'] = '';
@@ -33,17 +35,19 @@ if (PMLicensedFeatures
$_REQUEST['VALUE'] = G::decrypt(urldecode(utf8_encode($_REQUEST['VALUE'])), URL_KEY);
$_REQUEST['ABER'] = G::decrypt(urldecode(utf8_encode($_REQUEST['ABER'])), URL_KEY);
G::LoadClass('case');
$case = new Cases();
$actionsByEmail = new \ProcessMaker\BusinessModel\ActionsByEmail();
$cases = new Cases();
$caseFieldsABE = $cases->loadCase($_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX']);
$actionsByEmail->verifyLogin($_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX']);
$caseFieldsABE = $case->loadCase($_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX']);
if (is_null($caseFieldsABE['DEL_FINISH_DATE'])) {
$dataField = array();
$dataField = [];
$dataField[$_REQUEST['FIELD']] = $_REQUEST['VALUE'];
$caseFieldsABE ['APP_DATA'] = array_merge($caseFieldsABE ['APP_DATA'], $dataField);
$dataResponses = array();
$dataResponses = [];
$dataResponses['ABE_REQ_UID'] = $_REQUEST['ABER'];
$dataResponses['ABE_RES_CLIENT_IP'] = $_SERVER['REMOTE_ADDR'];
$dataResponses['ABE_RES_DATA'] = serialize($_REQUEST['VALUE']);
@@ -52,36 +56,42 @@ if (PMLicensedFeatures
try {
require_once 'classes/model/AbeResponses.php';
$abeAbeResponsesInstance = new AbeResponses();
$dataResponses['ABE_RES_UID'] = $abeAbeResponsesInstance->createOrUpdate($dataResponses);
} catch (Exception $error) {
throw $error;
} catch (Exception $e) {
throw $e;
}
$cases->updateCase($_REQUEST['APP_UID'], $caseFieldsABE);
$case->updateCase($_REQUEST['APP_UID'], $caseFieldsABE);
G::LoadClass('wsBase');
$ws = new wsBase();
$result = $ws->derivateCase($caseFieldsABE['CURRENT_USER_UID'], $_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX'], true);
$code = (is_array($result) ? $result['status_code'] : $result->status_code);
$result = $ws->derivateCase(
$caseFieldsABE['CURRENT_USER_UID'], $_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX'], true
);
$code = (is_array($result))? $result['status_code'] : $result->status_code;
if ($code != 0) {
throw new Exception('An error occurred while the application was being processed.<br /><br />
throw new Exception(
'An error occurred while the application was being processed.<br /><br />
Error code: ' . $result->status_code . '<br />
Error message: ' . $result->message . '<br /><br />');
Error message: ' . $result->message . '<br /><br />'
);
}
//Update
$dataResponses['ABE_RES_STATUS'] = ($code == 0 ? 'SENT' : 'ERROR');
$dataResponses['ABE_RES_MESSAGE'] = ($code == 0 ? '-' : $result->message);
$dataResponses['ABE_RES_STATUS'] = ($code == 0)? 'SENT' : 'ERROR';
$dataResponses['ABE_RES_MESSAGE'] = ($code == 0)? '-' : $result->message;
try {
$abeAbeResponsesInstance = new AbeResponses();
$abeAbeResponsesInstance->createOrUpdate($dataResponses);
} catch (Exception $error) {
throw $error;
} catch (Exception $e) {
throw $e;
}
$message = '<strong>The answer has been submited. Thank you</strong>';
@@ -93,10 +103,11 @@ if (PMLicensedFeatures
$dataAbeConfiguration = loadAbeConfiguration($dataAbeRequests['ABE_UID']);
if ($dataAbeConfiguration['ABE_CASE_NOTE_IN_RESPONSE'] == 1) {
$response = new stdclass();
$response = new stdClass();
$response->usrUid = $caseFieldsABE['APP_DATA']['USER_LOGGED'];
$response->appUid = $_REQUEST['APP_UID'];
$response->noteText = "Check the information that was sent for the receiver: " . $dataAbeRequests['ABE_REQ_SENT_TO'];
$response->noteText = 'Check the information that was sent for the receiver: ' .
$dataAbeRequests['ABE_REQ_SENT_TO'];
postNote($response);
}
@@ -108,14 +119,33 @@ if (PMLicensedFeatures
}
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', array('MESSAGE' => $message));
} catch (Exception $error) {
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => $error->getMessage() . 'Please contact to your system administrator.'));
} catch (Exception $e) {
$G_PUBLISH->AddContent(
'xmlform',
'xmlform',
'login/showMessage',
'',
['MESSAGE' => $e->getMessage() . 'Please contact to your system administrator.']
);
}
G::RenderPage('publish', 'blank');
break;
}
}
} else {
?>
<html>
<head>
<title></title>
<script type="text/javascript" src="/js/maborak/core/maborak.js"></script>
</head>
<body>
<script type="text/javascript">
location.assign(location.href + "&BROWSER_TIME_ZONE_OFFSET=" + getBrowserTimeZoneOffset());
</script>
</body>
</html>
<?php
}
/*----------------------------------********---------------------------------*/

View File

@@ -1,12 +1,14 @@
<?php
if (PMLicensedFeatures
::getSingleton()
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) {
if (PMLicensedFeatures::getSingleton()->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
try {
G::LoadClass('case');
G::LoadClass('pmDynaform');
//Validations
if (!isset($_REQUEST['APP_UID'])) {
$_REQUEST['APP_UID'] = '';
@@ -24,13 +26,16 @@ if (PMLicensedFeatures
throw new Exception('The parameter DEL_INDEX is empty.');
}
G::LoadClass('case');
G::LoadClass('pmDynaform');
$case = new Cases();
$actionsByEmail = new \ProcessMaker\BusinessModel\ActionsByEmail();
$cases = new Cases();
$caseFields = $cases->loadCase(G::decrypt($_REQUEST['APP_UID'], URL_KEY),G::decrypt($_REQUEST['DEL_INDEX'], URL_KEY));
$applicationUid = G::decrypt($_REQUEST['APP_UID'], URL_KEY);
$delIndex = G::decrypt($_REQUEST['DEL_INDEX'], URL_KEY);
$actionsByEmail->verifyLogin($applicationUid, $delIndex);
$caseFields = $case->loadCase($applicationUid, $delIndex);
//
$criteria = new Criteria();
$criteria->addSelectColumn(DynaformPeer::DYN_CONTENT);
$criteria->addSelectColumn(DynaformPeer::PRO_UID);
@@ -40,7 +45,10 @@ if (PMLicensedFeatures
$result->next();
$configuration = $result->getRow();
$action = 'ActionsByEmailDataFormPost.php?APP_UID=' . $_REQUEST['APP_UID'] . '&DEL_INDEX=' . $_REQUEST['DEL_INDEX'] . '&ABER=' . $_REQUEST['ABER'];
$action = 'ActionsByEmailDataFormPost.php?APP_UID=' . $_REQUEST['APP_UID'] . '&DEL_INDEX=' .
$_REQUEST['DEL_INDEX'] . '&ABER=' . $_REQUEST['ABER'];
$record = [];
$record['DYN_CONTENT'] = $configuration['DYN_CONTENT'];
$record['PRO_UID'] = $configuration['PRO_UID'];
$record['CURRENT_DYNAFORM'] = G::decrypt($_REQUEST['DYN_UID'], URL_KEY);
@@ -48,16 +56,38 @@ if (PMLicensedFeatures
$record['DEL_INDEX'] = $_REQUEST['DEL_INDEX'];
$record['ABER'] = $_REQUEST['ABER'];
$record['APP_DATA'] = $caseFields['APP_DATA'];
if (is_null($caseFields['DEL_FINISH_DATE'])) {
$a = new pmDynaform($record);
$a->printABE($action,$record);
} else {
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', array('MESSAGE' => '<strong>The form has already been filled and sent.</strong>'));
$G_PUBLISH->AddContent(
'xmlform',
'xmlform',
'login/showInfo',
'',
['MESSAGE' => '<strong>The form has already been filled and sent.</strong>']
);
}
} catch (Exception $error) {
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', array('MESSAGE' => $error->getMessage()));
} catch (Exception $e) {
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', ['MESSAGE' => $e->getMessage()]);
}
G::RenderPage('publish', 'blank');
}
} else {
?>
<html>
<head>
<title></title>
<script type="text/javascript" src="/js/maborak/core/maborak.js"></script>
</head>
<body>
<script type="text/javascript">
location.assign(location.href + "&BROWSER_TIME_ZONE_OFFSET=" + getBrowserTimeZoneOffset());
</script>
</body>
</html>
<?php
}

View File

@@ -19,12 +19,19 @@ class ActionsByEmail
case 'configuration':
require_once 'classes/model/AbeConfiguration.php';
$abeConfigurationInstance = new \AbeConfiguration();
if (isset($feature['fields']['ABE_CASE_NOTE_IN_RESPONSE'])) {
$noteValues = json_decode($feature['fields']['ABE_CASE_NOTE_IN_RESPONSE']);
foreach ($noteValues as $value) {
$feature['fields']['ABE_CASE_NOTE_IN_RESPONSE'] = $value;
$arrayAux = json_decode($feature['fields']['ABE_CASE_NOTE_IN_RESPONSE']);
$feature['fields']['ABE_CASE_NOTE_IN_RESPONSE'] = (int)((!empty($arrayAux))? array_shift($arrayAux) : 0);
}
if (isset($feature['fields']['ABE_FORCE_LOGIN'])) {
$arrayAux = json_decode($feature['fields']['ABE_FORCE_LOGIN']);
$feature['fields']['ABE_FORCE_LOGIN'] = (int)((!empty($arrayAux))? array_shift($arrayAux) : 0);
}
$abeConfigurationInstance->createOrUpdate($feature['fields']);
break;
default:
@@ -61,6 +68,7 @@ class ActionsByEmail
$configuration['ABE_ACTION_FIELD'] = $configuration['ABE_ACTION_FIELD'];
$configuration['ABE_MAILSERVER_OR_MAILCURRENT'] = $configuration['ABE_MAILSERVER_OR_MAILCURRENT'];
$configuration['ABE_CASE_NOTE_IN_RESPONSE'] = $configuration['ABE_CASE_NOTE_IN_RESPONSE'] ? '["1"]' : '[]';
$configuration['ABE_FORCE_LOGIN'] = ($configuration['ABE_FORCE_LOGIN'])? '["1"]' : '[]';
$configuration['ABE_CUSTOM_GRID'] = unserialize($configuration['ABE_CUSTOM_GRID']);
}
$configuration['feature'] = 'ActionsByEmail';
@@ -623,4 +631,107 @@ class ActionsByEmail
//Return
return $message;
}
/**
* Verify login
*
* @param string $applicationUid Unique id of Case
* @param int $delIndex Delegation index
*
* @return void
*/
public function verifyLogin($applicationUid, $delIndex)
{
try {
//Verify data and Set variables
$case = new \ProcessMaker\BusinessModel\Cases();
$arrayAppDelegationData = $case->getAppDelegationRecordByPk(
$applicationUid, $delIndex, ['$applicationUid' => '$applicationUid', '$delIndex' => '$delIndex']
);
//Verify login
$criteria = new \Criteria('workflow');
$criteria->add(\AbeConfigurationPeer::PRO_UID, $arrayAppDelegationData['PRO_UID'], \Criteria::EQUAL);
$criteria->add(\AbeConfigurationPeer::TAS_UID, $arrayAppDelegationData['TAS_UID'], \Criteria::EQUAL);
$rsCriteria = \AbeConfigurationPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
if ($rsCriteria->next()) {
$record = $rsCriteria->getRow();
if ($record['ABE_FORCE_LOGIN'] == 1) {
$flagLogin = false;
if (!isset($_SESSION['USER_LOGGED'])) {
/*----------------------------------********---------------------------------*/
//SSO
if (\PMLicensedFeatures::getSingleton()->verifyfeature('x4TTzlISnp2K2tnSTJoMC8rTDRMTjlhMCtZeXV0QnNCLzU=')) {
\G::LoadClass('pmSso');
$sso = new \pmSsoClass();
if ($sso->ssocVerifyUser()) {
global $RBAC;
//Start new session
@session_destroy();
session_start();
session_regenerate_id();
//Authenticate
$_GET['u'] = $_SERVER['REQUEST_URI'];
require_once(PATH_METHODS . 'login' . PATH_SEP . 'authenticationSso.php');
exit(0);
}
}
/*----------------------------------********---------------------------------*/
if (defined('PM_SINGLE_SIGN_ON')) {
$pluginRegistry = &\PMPluginRegistry::getSingleton();
if ($pluginRegistry->existsTrigger(PM_SINGLE_SIGN_ON)) {
if ($pluginRegistry->executeTriggers(PM_SINGLE_SIGN_ON, null)) {
global $RBAC;
//Start new session
@session_destroy();
session_start();
session_regenerate_id();
//Authenticate
$_GET['u'] = $_SERVER['REQUEST_URI'];
require_once(PATH_METHODS . 'login' . PATH_SEP . 'authenticationSso.php');
exit(0);
}
}
}
$flagLogin = true;
} else {
if ($_SESSION['USER_LOGGED'] != $arrayAppDelegationData['USR_UID']) {
\G::SendTemporalMessage('ID_CASE_ASSIGNED_ANOTHER_USER', 'error', 'label');
$flagLogin = true;
}
}
if ($flagLogin) {
header(
'Location: /sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN .
'/login/login?u=' . urlencode($_SERVER['REQUEST_URI'])
);
exit(0);
}
}
}
} catch (\Exception $e) {
throw $e;
}
}
}

View File

@@ -8,6 +8,7 @@
<form id="{$form_id}" method="post" enctype="multipart/form-data" action="{$form_action}" class="form-signin" style="margin:0px;" accept-charset="UTF-8" role="form">
{$form.BROWSER_TIME_ZONE_OFFSET}
{$form.URL}
{$form.USR_USERNAME}
{$form.USR_PASSWORD}

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm type="xmlform" name="login/TimeZoneAlert" enabletemplate="1">
<BROWSER_TIME_ZONE_OFFSET type="hidden" />
<URL type="hidden" />
<USR_USERNAME type="hidden" />
<USR_PASSWORD type="hidden" />

View File

@@ -904,6 +904,7 @@ if (! defined( 'EXECUTE_BY_CRON' )) {
$noLoginFiles = $noLoginFolders = array ();
$noLoginFiles[] = 'login';
$noLoginFiles[] = 'authentication';
$noLoginFiles[] = 'authenticationSso';
$noLoginFiles[] = 'login_Ajax';
$noLoginFiles[] = 'dbInfo';
$noLoginFiles[] = 'sysLoginVerify';