Merged in feature/HOR-3906 (pull request #6100)
feature/HOR-3906 Approved-by: David Callizaya <david.callizaya@processmaker.com> Approved-by: Paula Quispe <paula.quispe@processmaker.com> Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
17
Rakefile
17
Rakefile
@@ -1,5 +1,5 @@
|
|||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
|
require 'json'
|
||||||
desc "Default Task - Build Library"
|
desc "Default Task - Build Library"
|
||||||
task :default => [:required] do
|
task :default => [:required] do
|
||||||
Rake::Task['build'].execute
|
Rake::Task['build'].execute
|
||||||
@@ -53,6 +53,7 @@ task :build => [:required] do
|
|||||||
mafeDir = targetDir + "/mafe"
|
mafeDir = targetDir + "/mafe"
|
||||||
pmdynaformDir = targetDir + "/pmdynaform"
|
pmdynaformDir = targetDir + "/pmdynaform"
|
||||||
|
|
||||||
|
generateEnviromentVariables
|
||||||
prepareDirs([targetDir, pmUIDir, mafeDir, pmdynaformDir, jsTargetDir, cssTargetDir, cssImagesTargetDir, imgTargetDir, pmUIFontsDir])
|
prepareDirs([targetDir, pmUIDir, mafeDir, pmdynaformDir, jsTargetDir, cssTargetDir, cssImagesTargetDir, imgTargetDir, pmUIFontsDir])
|
||||||
|
|
||||||
buildPmUi(Dir.pwd + "/vendor/colosa/pmUI", targetDir, mode)
|
buildPmUi(Dir.pwd + "/vendor/colosa/pmUI", targetDir, mode)
|
||||||
@@ -134,6 +135,20 @@ task :build => [:required] do
|
|||||||
#task argv1.to_sym do ; end
|
#task argv1.to_sym do ; end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def generateEnviromentVariables()
|
||||||
|
puts "Creating System Constants..."
|
||||||
|
content = "var __env = __env || {};"
|
||||||
|
file = File.read('./config/enviromentvariables.json')
|
||||||
|
dataUser = JSON.parse(file)
|
||||||
|
content = content + "__env.USER_GUEST = " + JSON.generate(dataUser['constants']['userguest'])
|
||||||
|
dir = "vendor/colosa/MichelangeloFE/src/enviroment/"
|
||||||
|
# create a directory enviroment
|
||||||
|
FileUtils.mkdir_p(dir)
|
||||||
|
File.open(dir +'constants.js', 'w') { |fileWrite|
|
||||||
|
fileWrite.write content + ';'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def buildPmUi(homeDir, targetDir, mode)
|
def buildPmUi(homeDir, targetDir, mode)
|
||||||
puts "\nBuilding PMUI library".green.bold
|
puts "\nBuilding PMUI library".green.bold
|
||||||
|
|
||||||
|
|||||||
12
config/enviromentvariables.json
Normal file
12
config/enviromentvariables.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "Environment variables",
|
||||||
|
"description": "Definition of system constants",
|
||||||
|
"constants": {
|
||||||
|
"userguest": {
|
||||||
|
"uid": "00000000000000000000000000000002",
|
||||||
|
"firstname": "Guest",
|
||||||
|
"lastname": "Guest",
|
||||||
|
"username": "guest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
21
gulpfile.js
21
gulpfile.js
@@ -471,7 +471,26 @@ gulp.task('clean', function () {
|
|||||||
cleanDirectory('workflow/public_html/lib');
|
cleanDirectory('workflow/public_html/lib');
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('default', ['clean'], function (cb) {
|
/**
|
||||||
|
* This scheduled task is to be able to create the guest user constants
|
||||||
|
*/
|
||||||
|
gulp.task('__env', function (cb) {
|
||||||
|
var data = require('./config/enviromentvariables.json'),
|
||||||
|
pathEnviroment = 'vendor/colosa/MichelangeloFE/src/enviroment/',
|
||||||
|
content = 'var __env = __env || {};';
|
||||||
|
|
||||||
|
gutil.log(gutil.colors.green('Creating System Constants...'));
|
||||||
|
if (!fs.existsSync(pathEnviroment)){
|
||||||
|
fs.mkdirSync(pathEnviroment);
|
||||||
|
}
|
||||||
|
fs.writeFile(
|
||||||
|
pathEnviroment + 'constants.js',
|
||||||
|
content + '__env.USER_GUEST = ' + JSON.stringify(data.constants.userguest) + ';',
|
||||||
|
cb
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('default', ['clean', '__env'], function (cb) {
|
||||||
var i, tasks = [];
|
var i, tasks = [];
|
||||||
|
|
||||||
gutil.log(gutil.colors.green('Initializing ProcessMaker building...'));
|
gutil.log(gutil.colors.green('Initializing ProcessMaker building...'));
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
@@ -44,57 +45,60 @@ use ProcessMaker\Plugins\PluginRegistry;
|
|||||||
class RbacUsers extends BaseRbacUsers
|
class RbacUsers extends BaseRbacUsers
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private $userUidReserved = [RBAC::GUEST_USER_UID];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autentificacion de un usuario a traves de la clase RBAC_user
|
* Authentication of a user through the class RBAC_user
|
||||||
*
|
*
|
||||||
* verifica que un usuario tiene derechos de iniciar una aplicacion
|
* verifies that a user has permission to start an application
|
||||||
*
|
*
|
||||||
* @author Fernando Ontiveros Lira <fernando@colosa.com>
|
* @access public
|
||||||
* access public
|
|
||||||
* Function verifyLogin
|
* Function verifyLogin
|
||||||
*
|
*
|
||||||
* @param string $strUser UserId (login) de usuario
|
* @param string $userName UserId (login) de usuario
|
||||||
* @param string $strPass Password
|
* @param string $password Password
|
||||||
* @return
|
* @return type
|
||||||
* -1: no existe usuario
|
* -1: no user exists
|
||||||
* -2: password errado
|
* -2: wrong password
|
||||||
* -3: usuario inactivo
|
* -3: inactive user
|
||||||
* -4: usuario vencido
|
* -4: expired user
|
||||||
* -6: role inactivo
|
* -6: role inactive
|
||||||
* n : uid de usuario
|
* n : string user uid
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function verifyLogin($sUsername, $sPassword)
|
public function verifyLogin($userName, $password)
|
||||||
{
|
{
|
||||||
//invalid user
|
//invalid user
|
||||||
if ($sUsername == '') {
|
if ($userName == '') {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
//invalid password
|
//invalid password
|
||||||
if ($sPassword == '') {
|
if ($password == '') {
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
$con = Propel::getConnection(RbacUsersPeer::DATABASE_NAME);
|
$con = Propel::getConnection(RbacUsersPeer::DATABASE_NAME);
|
||||||
try {
|
try {
|
||||||
$c = new Criteria('rbac');
|
$c = new Criteria('rbac');
|
||||||
$c->add(RbacUsersPeer::USR_USERNAME, $sUsername);
|
$c->add(RbacUsersPeer::USR_USERNAME, $userName);
|
||||||
/* @var $rs RbacUsers[] */
|
/* @var $rs RbacUsers[] */
|
||||||
$rs = RbacUsersPeer::doSelect($c, Propel::getDbConnection('rbac_ro'));
|
$rs = RbacUsersPeer::doSelect($c, Propel::getDbConnection('rbac_ro'));
|
||||||
if (is_array($rs) && isset($rs[0]) && is_object($rs[0]) && get_class($rs[0]) == 'RbacUsers') {
|
if (is_array($rs) && isset($rs[0]) && is_object($rs[0]) && get_class($rs[0]) == 'RbacUsers') {
|
||||||
$aFields = $rs[0]->toArray(BasePeer::TYPE_FIELDNAME);
|
$dataFields = $rs[0]->toArray(BasePeer::TYPE_FIELDNAME);
|
||||||
//verify password with md5, and md5 format
|
//verify password with md5, and md5 format
|
||||||
if (mb_strtoupper($sUsername, 'utf-8') === mb_strtoupper($aFields['USR_USERNAME'], 'utf-8')) {
|
if (mb_strtoupper($userName, 'utf-8') === mb_strtoupper($dataFields['USR_USERNAME'], 'utf-8')) {
|
||||||
if( Bootstrap::verifyHashPassword($sPassword, $rs[0]->getUsrPassword()) ) {
|
if (Bootstrap::verifyHashPassword($password, $rs[0]->getUsrPassword())) {
|
||||||
if ($aFields['USR_DUE_DATE'] < date('Y-m-d')) {
|
if ($dataFields['USR_DUE_DATE'] < date('Y-m-d')) {
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
if ($aFields['USR_STATUS'] != 1) {
|
if ($dataFields['USR_STATUS'] != 1 && $dataFields['USR_UID'] !== RBAC::GUEST_USER_UID) {
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
$role = $this->getUserRole($aFields['USR_UID']);
|
$role = $this->getUserRole($dataFields['USR_UID']);
|
||||||
if ($role['ROL_STATUS'] == 0) {
|
if ($role['ROL_STATUS'] == 0) {
|
||||||
return -6;
|
return -6;
|
||||||
}
|
}
|
||||||
return $aFields['USR_UID'];
|
|
||||||
|
return $dataFields['USR_UID'];
|
||||||
} else {
|
} else {
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@@ -104,100 +108,134 @@ class RbacUsers extends BaseRbacUsers
|
|||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} catch (Exception $oError) {
|
} catch (Exception $error) {
|
||||||
throw($oError);
|
throw($error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function verifyUser($sUsername)
|
/**
|
||||||
|
* Verify if the userName exists
|
||||||
|
* @param string $userName
|
||||||
|
* @return integer
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function verifyUser($userName)
|
||||||
{
|
{
|
||||||
//invalid user
|
//invalid user
|
||||||
if ($sUsername == '') {
|
if ($userName == '') {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
$con = Propel::getConnection(RbacUsersPeer::DATABASE_NAME);
|
$con = Propel::getConnection(RbacUsersPeer::DATABASE_NAME);
|
||||||
try {
|
try {
|
||||||
$c = new Criteria('rbac');
|
$c = new Criteria('rbac');
|
||||||
$c->add(RbacUsersPeer::USR_USERNAME, $sUsername);
|
$c->add(RbacUsersPeer::USR_USERNAME, $userName);
|
||||||
$rs = RbacUsersPeer::doSelect($c, Propel::getDbConnection('rbac_ro'));
|
$rs = RbacUsersPeer::doSelect($c, Propel::getDbConnection('rbac_ro'));
|
||||||
if (is_array($rs) && isset($rs[0]) && is_object($rs[0]) && get_class($rs[0]) == 'RbacUsers') {
|
if (is_array($rs) && isset($rs[0]) && is_object($rs[0]) && get_class($rs[0]) == 'RbacUsers') {
|
||||||
//return the row for futher check of which Autentificacion method belongs this user
|
//return the row for futher check of which Autentificacion method belongs this user
|
||||||
$this->fields = $rs[0]->toArray(BasePeer::TYPE_FIELDNAME);
|
$this->fields = $rs[0]->toArray(BasePeer::TYPE_FIELDNAME);
|
||||||
;
|
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} catch (Exception $oError) {
|
} catch (Exception $error) {
|
||||||
throw($oError);
|
throw($error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getByUsername($sUsername)
|
/**
|
||||||
|
* Get user info by userName
|
||||||
|
* @param string $userName
|
||||||
|
* @return array $dataFields if exist
|
||||||
|
* false if does not exist
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function getByUsername($userName)
|
||||||
{
|
{
|
||||||
//invalid user
|
//invalid user
|
||||||
if ($sUsername == '') {
|
if ($userName == '') {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
$con = Propel::getConnection(RbacUsersPeer::DATABASE_NAME);
|
$con = Propel::getConnection(RbacUsersPeer::DATABASE_NAME);
|
||||||
try {
|
try {
|
||||||
$c = new Criteria('rbac');
|
$c = new Criteria('rbac');
|
||||||
$c->add(RbacUsersPeer::USR_USERNAME, $sUsername);
|
$c->add(RbacUsersPeer::USR_USERNAME, $userName);
|
||||||
$rs = RbacUsersPeer::doSelect($c, Propel::getDbConnection('rbac_ro'));
|
$rs = RbacUsersPeer::doSelect($c, Propel::getDbConnection('rbac_ro'));
|
||||||
|
|
||||||
if (is_array($rs) && isset($rs[0]) && is_object($rs[0]) && get_class($rs[0]) == 'RbacUsers') {
|
if (is_array($rs) && isset($rs[0]) && is_object($rs[0]) && get_class($rs[0]) == 'RbacUsers') {
|
||||||
$aFields = $rs[0]->toArray(BasePeer::TYPE_FIELDNAME);
|
$dataFields = $rs[0]->toArray(BasePeer::TYPE_FIELDNAME);
|
||||||
return $aFields;
|
|
||||||
|
return $dataFields;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (Exception $oError) {
|
} catch (Exception $error) {
|
||||||
throw($oError);
|
throw($error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function verifyUserId($sUserId)
|
/**
|
||||||
|
* Verify user by Uid
|
||||||
|
* @param string $userUid
|
||||||
|
* @return integer
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function verifyUserId($userUid)
|
||||||
{
|
{
|
||||||
//invalid user
|
//invalid user
|
||||||
if ($sUserId == '') {
|
if ($userUid == '') {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
$con = Propel::getConnection(RbacUsersPeer::DATABASE_NAME);
|
$con = Propel::getConnection(RbacUsersPeer::DATABASE_NAME);
|
||||||
try {
|
try {
|
||||||
$c = new Criteria('rbac');
|
$c = new Criteria('rbac');
|
||||||
$c->add(RbacUsersPeer::USR_UID, $sUserId);
|
$c->add(RbacUsersPeer::USR_UID, $userUid);
|
||||||
$rs = RbacUsersPeer::doSelect($c, Propel::getDbConnection('rbac_ro'));
|
$rs = RbacUsersPeer::doSelect($c, Propel::getDbConnection('rbac_ro'));
|
||||||
if (is_array($rs) && isset($rs[0]) && is_object($rs[0]) && get_class($rs[0]) == 'RbacUsers') {
|
if (is_array($rs) && isset($rs[0]) && is_object($rs[0]) && get_class($rs[0]) == 'RbacUsers') {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} catch (Exception $oError) {
|
} catch (Exception $error) {
|
||||||
throw($oError);
|
throw($error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function load($sUsrUid)
|
/**
|
||||||
|
* Load user information by Uid
|
||||||
|
* @param string $userUid
|
||||||
|
* @return array $dataFields
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function load($userUid)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection(RbacUsersPeer::DATABASE_NAME);
|
$con = Propel::getConnection(RbacUsersPeer::DATABASE_NAME);
|
||||||
try {
|
try {
|
||||||
$c = new Criteria('rbac');
|
$c = new Criteria('rbac');
|
||||||
$c->add(RbacUsersPeer::USR_UID, $sUsrUid);
|
$c->add(RbacUsersPeer::USR_UID, $userUid);
|
||||||
$resultSet = RbacUsersPeer::doSelectRS($c, Propel::getDbConnection('rbac_ro'));
|
$resultSet = RbacUsersPeer::doSelectRS($c, Propel::getDbConnection('rbac_ro'));
|
||||||
if ($resultSet->next()) {
|
if ($resultSet->next()) {
|
||||||
$this->hydrate($resultSet);
|
$this->hydrate($resultSet);
|
||||||
$aFields = $this->toArray(BasePeer::TYPE_FIELDNAME);
|
$dataFields = $this->toArray(BasePeer::TYPE_FIELDNAME);
|
||||||
return $aFields;
|
|
||||||
|
return $dataFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} catch (Exception $oError) {
|
} catch (Exception $error) {
|
||||||
throw($oError);
|
throw($error);
|
||||||
}
|
}
|
||||||
return $res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create($aData)
|
/**
|
||||||
|
* Create an user
|
||||||
|
* @param string $infoData
|
||||||
|
* @return array
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function create($infoData)
|
||||||
{
|
{
|
||||||
if (class_exists('ProcessMaker\Plugins\PluginRegistry')) {
|
if (class_exists('ProcessMaker\Plugins\PluginRegistry')) {
|
||||||
$pluginRegistry = PluginRegistry::loadSingleton();
|
$pluginRegistry = PluginRegistry::loadSingleton();
|
||||||
@@ -209,116 +247,134 @@ class RbacUsers extends BaseRbacUsers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$oConnection = Propel::getConnection(RbacUsersPeer::DATABASE_NAME);
|
$connection = Propel::getConnection(RbacUsersPeer::DATABASE_NAME);
|
||||||
try {
|
try {
|
||||||
$oRBACUsers = new RbacUsers();
|
$rbacUsers = new RbacUsers();
|
||||||
do {
|
do {
|
||||||
$aData['USR_UID'] = G::generateUniqueID();
|
$infoData['USR_UID'] = G::generateUniqueID();
|
||||||
} while ($oRBACUsers->load($aData['USR_UID']));
|
} while ($rbacUsers->load($infoData['USR_UID']));
|
||||||
$oRBACUsers->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
$rbacUsers->fromArray($infoData, BasePeer::TYPE_FIELDNAME);
|
||||||
//if ($oRBACUsers->validate()) {
|
$result = $rbacUsers->save();
|
||||||
//$oConnection->begin();
|
|
||||||
$iResult = $oRBACUsers->save();
|
return $infoData['USR_UID'];
|
||||||
//$oConnection->commit();
|
} catch (Exception $error) {
|
||||||
return $aData['USR_UID'];
|
$connection->rollback();
|
||||||
/* }
|
throw($error);
|
||||||
else {
|
|
||||||
$sMessage = '';
|
|
||||||
$aValidationFailures = $oRBACUsers->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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update($aData)
|
/**
|
||||||
|
* Update an user
|
||||||
|
* @param string $infoData
|
||||||
|
* @return boolean
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function update($infoData)
|
||||||
{
|
{
|
||||||
|
if (in_array($infoData['USR_UID'], $this->userUidReserved)) {
|
||||||
|
throw new Exception(G::LoadTranslation("ID_USER_CAN_NOT_UPDATE", array($infoData['USR_UID'])));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$oConnection = Propel::getConnection(RbacUsersPeer::DATABASE_NAME);
|
$oConnection = Propel::getConnection(RbacUsersPeer::DATABASE_NAME);
|
||||||
try {
|
try {
|
||||||
$this->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
$this->fromArray($infoData, BasePeer::TYPE_FIELDNAME);
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
$iResult = $this->save();
|
$result = $this->save();
|
||||||
} catch (Exception $oError) {
|
} catch (Exception $error) {
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw($oError);
|
throw($error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function remove($sUserUID = '')
|
/**
|
||||||
|
* Remove an user
|
||||||
|
* @param string $userUid
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function remove($userUid = '')
|
||||||
{
|
{
|
||||||
$this->setUsrUid($sUserUID);
|
$this->setUsrUid($userUid);
|
||||||
$this->delete();
|
$this->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Added by Qennix at Feb 14th, 2011
|
/**
|
||||||
//Gets an associative array with total users by authentication sources
|
* Gets an associative array with total users by authentication sources
|
||||||
|
* @return array $listAuth
|
||||||
|
*/
|
||||||
public function getAllUsersByAuthSource()
|
public function getAllUsersByAuthSource()
|
||||||
{
|
{
|
||||||
$oCriteria = new Criteria('rbac');
|
$criteria = new Criteria('rbac');
|
||||||
$oCriteria->addSelectColumn(RbacUsersPeer::UID_AUTH_SOURCE);
|
$criteria->addSelectColumn(RbacUsersPeer::UID_AUTH_SOURCE);
|
||||||
$oCriteria->addSelectColumn('COUNT(*) AS CNT');
|
$criteria->addSelectColumn('COUNT(*) AS CNT');
|
||||||
$oCriteria->add(RbacUsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL);
|
$criteria->add(RbacUsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL);
|
||||||
$oCriteria->addGroupByColumn(RbacUsersPeer::UID_AUTH_SOURCE);
|
$criteria->addGroupByColumn(RbacUsersPeer::UID_AUTH_SOURCE);
|
||||||
$oDataset = RbacUsersPeer::doSelectRS($oCriteria, Propel::getDbConnection('rbac_ro'));
|
$dataset = RbacUsersPeer::doSelectRS($criteria, Propel::getDbConnection('rbac_ro'));
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
$aAuth = Array();
|
$listAuth = [];
|
||||||
while ($oDataset->next()) {
|
while ($dataset->next()) {
|
||||||
$row = $oDataset->getRow();
|
$row = $dataset->getRow();
|
||||||
$aAuth[$row['UID_AUTH_SOURCE']] = $row['CNT'];
|
$listAuth[$row['UID_AUTH_SOURCE']] = $row['CNT'];
|
||||||
}
|
}
|
||||||
return $aAuth;
|
|
||||||
|
return $listAuth;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Returns all users with auth_source
|
/**
|
||||||
public function getListUsersByAuthSource($auth_source)
|
* Get users list related to an authentication source
|
||||||
|
* @param string $authSource
|
||||||
|
* @return array $listUsers, all users with auth_source
|
||||||
|
*/
|
||||||
|
public function getListUsersByAuthSource($authSource)
|
||||||
{
|
{
|
||||||
$oCriteria = new Criteria('rbac');
|
$criteria = new Criteria('rbac');
|
||||||
$oCriteria->addSelectColumn(RbacUsersPeer::USR_UID);
|
$criteria->addSelectColumn(RbacUsersPeer::USR_UID);
|
||||||
|
|
||||||
if ($auth_source == '00000000000000000000000000000000') {
|
if ($authSource == '00000000000000000000000000000000') {
|
||||||
$oCriteria->add(
|
$criteria->add(
|
||||||
$oCriteria->getNewCriterion(RbacUsersPeer::UID_AUTH_SOURCE, $auth_source, Criteria::EQUAL)->addOr(
|
$criteria->getNewCriterion(RbacUsersPeer::UID_AUTH_SOURCE, $authSource, Criteria::EQUAL)->addOr(
|
||||||
$oCriteria->getNewCriterion(RbacUsersPeer::UID_AUTH_SOURCE, '', Criteria::EQUAL)
|
$criteria->getNewCriterion(RbacUsersPeer::UID_AUTH_SOURCE, '', Criteria::EQUAL)
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
$oCriteria->add(RbacUsersPeer::UID_AUTH_SOURCE, $auth_source, Criteria::EQUAL);
|
$criteria->add(RbacUsersPeer::UID_AUTH_SOURCE, $authSource, Criteria::EQUAL);
|
||||||
}
|
}
|
||||||
$oCriteria->add(RbacUsersPeer::USR_STATUS, 0, Criteria::NOT_EQUAL);
|
$criteria->add(RbacUsersPeer::USR_STATUS, 0, Criteria::NOT_EQUAL);
|
||||||
$oDataset = RbacUsersPeer::doSelectRS($oCriteria, Propel::getDbConnection('rbac_ro'));
|
$dataset = RbacUsersPeer::doSelectRS($criteria, Propel::getDbConnection('rbac_ro'));
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$aUsers = array();
|
$listUsers = [];
|
||||||
while ($oDataset->next()) {
|
while ($dataset->next()) {
|
||||||
$row = $oDataset->getRow();
|
$row = $dataset->getRow();
|
||||||
$aUsers[] = $row['USR_UID'];
|
$listUsers[] = $row['USR_UID'];
|
||||||
}
|
}
|
||||||
return $aUsers;
|
|
||||||
|
return $listUsers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserRole($UsrUid)
|
/**
|
||||||
|
* Get the user's role
|
||||||
|
* @param string $userUid
|
||||||
|
* @return array $row
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function getUserRole($userUid)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection(UsersRolesPeer::DATABASE_NAME);
|
$con = Propel::getConnection(UsersRolesPeer::DATABASE_NAME);
|
||||||
try {
|
try {
|
||||||
$c = new Criteria( 'rbac' );
|
$c = new Criteria('rbac');
|
||||||
$c->clearSelectColumns();
|
$c->clearSelectColumns();
|
||||||
$c->addSelectColumn ( RolesPeer::ROL_UID );
|
$c->addSelectColumn(RolesPeer::ROL_UID);
|
||||||
$c->addSelectColumn ( RolesPeer::ROL_CODE );
|
$c->addSelectColumn(RolesPeer::ROL_CODE);
|
||||||
$c->addSelectColumn ( RolesPeer::ROL_STATUS );
|
$c->addSelectColumn(RolesPeer::ROL_STATUS);
|
||||||
$c->addJoin ( UsersRolesPeer::ROL_UID, RolesPeer::ROL_UID );
|
$c->addJoin(UsersRolesPeer::ROL_UID, RolesPeer::ROL_UID);
|
||||||
$c->add ( UsersRolesPeer::USR_UID, $UsrUid );
|
$c->add(UsersRolesPeer::USR_UID, $userUid);
|
||||||
$rs = UsersRolesPeer::doSelectRs( $c , Propel::getDbConnection('rbac_ro'));
|
$rs = UsersRolesPeer::doSelectRs($c, Propel::getDbConnection('rbac_ro'));
|
||||||
$rs->setFetchmode (ResultSet::FETCHMODE_ASSOC);
|
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$rs->next();
|
$rs->next();
|
||||||
$row = $rs->getRow();
|
$row = $rs->getRow();
|
||||||
|
|
||||||
return $row;
|
return $row;
|
||||||
}
|
} catch (Exception $error) {
|
||||||
catch (Exception $oError) {
|
throw($error);
|
||||||
throw($oError);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,6 +398,7 @@ class RbacUsers extends BaseRbacUsers
|
|||||||
);
|
);
|
||||||
$array = parent::toArray($keyType);
|
$array = parent::toArray($keyType);
|
||||||
unset($array[$key]);
|
unset($array[$key]);
|
||||||
|
|
||||||
return $array;
|
return $array;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ class Roles extends BaseRoles {
|
|||||||
$oCriteria->addSelectColumn(RolesPeer::ROL_UPDATE_DATE);
|
$oCriteria->addSelectColumn(RolesPeer::ROL_UPDATE_DATE);
|
||||||
$oCriteria->addSelectColumn(RolesPeer::ROL_STATUS);
|
$oCriteria->addSelectColumn(RolesPeer::ROL_STATUS);
|
||||||
$oCriteria->add(RolesPeer::ROL_UID, '', Criteria::NOT_EQUAL);
|
$oCriteria->add(RolesPeer::ROL_UID, '', Criteria::NOT_EQUAL);
|
||||||
|
$oCriteria->add(RolesPeer::ROL_CODE, RBAC::PROCESSMAKER_GUEST, Criteria::NOT_EQUAL);
|
||||||
$oCriteria->add(SystemsPeer::SYS_CODE, $systemCode);
|
$oCriteria->add(SystemsPeer::SYS_CODE, $systemCode);
|
||||||
$oCriteria->add(RolesPeer::ROL_CREATE_DATE, '', Criteria::NOT_EQUAL);
|
$oCriteria->add(RolesPeer::ROL_CREATE_DATE, '', Criteria::NOT_EQUAL);
|
||||||
$oCriteria->add(RolesPeer::ROL_UPDATE_DATE, '', Criteria::NOT_EQUAL);
|
$oCriteria->add(RolesPeer::ROL_UPDATE_DATE, '', Criteria::NOT_EQUAL);
|
||||||
@@ -158,7 +159,7 @@ class Roles extends BaseRoles {
|
|||||||
$oCriteria->addSelectColumn(RolesPeer::ROL_CREATE_DATE);
|
$oCriteria->addSelectColumn(RolesPeer::ROL_CREATE_DATE);
|
||||||
$oCriteria->addSelectColumn(RolesPeer::ROL_UPDATE_DATE);
|
$oCriteria->addSelectColumn(RolesPeer::ROL_UPDATE_DATE);
|
||||||
$oCriteria->addSelectColumn(RolesPeer::ROL_STATUS);
|
$oCriteria->addSelectColumn(RolesPeer::ROL_STATUS);
|
||||||
$oCriteria->add(RolesPeer::ROL_UID, '', Criteria::NOT_EQUAL);
|
$oCriteria->add(RolesPeer::ROL_UID, ['', RBAC::PROCESSMAKER_GUEST_UID], Criteria::NOT_IN);
|
||||||
$oCriteria->add(SystemsPeer::SYS_CODE, $systemCode);
|
$oCriteria->add(SystemsPeer::SYS_CODE, $systemCode);
|
||||||
$oCriteria->add(RolesPeer::ROL_CREATE_DATE, '', Criteria::NOT_EQUAL);
|
$oCriteria->add(RolesPeer::ROL_CREATE_DATE, '', Criteria::NOT_EQUAL);
|
||||||
$oCriteria->add(RolesPeer::ROL_UPDATE_DATE, '', Criteria::NOT_EQUAL);
|
$oCriteria->add(RolesPeer::ROL_UPDATE_DATE, '', Criteria::NOT_EQUAL);
|
||||||
@@ -572,7 +573,7 @@ class Roles extends BaseRoles {
|
|||||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$result->next();
|
$result->next();
|
||||||
|
|
||||||
$a = Array();
|
$a = [RBAC::PM_GUEST_CASE_UID];
|
||||||
while( $row = $result->getRow() ) {
|
while( $row = $result->getRow() ) {
|
||||||
$a[] = $row['PER_UID'];
|
$a[] = $row['PER_UID'];
|
||||||
$result->next();
|
$result->next();
|
||||||
|
|||||||
@@ -63,13 +63,15 @@ INSERT INTO `RBAC_PERMISSIONS` VALUES
|
|||||||
('00000000000000000000000000000062','PM_EDIT_USER_PROFILE_DEFAULT_MAIN_MENU_OPTIONS','2016-07-18 00:00:00','2016-07-18 00:00:00',1,'00000000000000000000000000000002'),
|
('00000000000000000000000000000062','PM_EDIT_USER_PROFILE_DEFAULT_MAIN_MENU_OPTIONS','2016-07-18 00:00:00','2016-07-18 00:00:00',1,'00000000000000000000000000000002'),
|
||||||
('00000000000000000000000000000063','PM_EDIT_USER_PROFILE_DEFAULT_CASES_MENU_OPTIONS','2016-07-18 00:00:00','2016-07-18 00:00:00',1,'00000000000000000000000000000002'),
|
('00000000000000000000000000000063','PM_EDIT_USER_PROFILE_DEFAULT_CASES_MENU_OPTIONS','2016-07-18 00:00:00','2016-07-18 00:00:00',1,'00000000000000000000000000000002'),
|
||||||
('00000000000000000000000000000064','PM_REASSIGNCASE_SUPERVISOR','2016-09-01 00:00:00','2016-09-01 00:00:00',1,'00000000000000000000000000000002'),
|
('00000000000000000000000000000064','PM_REASSIGNCASE_SUPERVISOR','2016-09-01 00:00:00','2016-09-01 00:00:00',1,'00000000000000000000000000000002'),
|
||||||
('00000000000000000000000000000065','PM_SETUP_CUSTOM_CASES_LIST','2017-03-27 00:00:00','2017-03-27 00:00:00',1,'00000000000000000000000000000002');
|
('00000000000000000000000000000065','PM_SETUP_CUSTOM_CASES_LIST','2017-03-27 00:00:00','2017-03-27 00:00:00',1,'00000000000000000000000000000002'),
|
||||||
|
('00000000000000000000000000000066','PM_GUEST_CASE','2017-03-27 00:00:00','2017-03-27 00:00:00',1,'00000000000000000000000000000002');
|
||||||
|
|
||||||
INSERT INTO `RBAC_ROLES` VALUES
|
INSERT INTO `RBAC_ROLES` VALUES
|
||||||
('00000000000000000000000000000001','','00000000000000000000000000000001','RBAC_ADMIN','2007-07-31 19:10:22','2007-08-03 12:24:36',1),
|
('00000000000000000000000000000001','','00000000000000000000000000000001','RBAC_ADMIN','2007-07-31 19:10:22','2007-08-03 12:24:36',1),
|
||||||
('00000000000000000000000000000002','','00000000000000000000000000000002','PROCESSMAKER_ADMIN','2007-07-31 19:10:22','2007-08-03 12:24:36',1),
|
('00000000000000000000000000000002','','00000000000000000000000000000002','PROCESSMAKER_ADMIN','2007-07-31 19:10:22','2007-08-03 12:24:36',1),
|
||||||
('00000000000000000000000000000003','','00000000000000000000000000000002','PROCESSMAKER_OPERATOR','2007-07-31 19:10:22','2007-08-03 12:24:36',1),
|
('00000000000000000000000000000003','','00000000000000000000000000000002','PROCESSMAKER_OPERATOR','2007-07-31 19:10:22','2007-08-03 12:24:36',1),
|
||||||
('00000000000000000000000000000004', '', '00000000000000000000000000000002', 'PROCESSMAKER_MANAGER', '2010-03-29 09:14:15', '2010-03-29 09:19:53', 1);
|
('00000000000000000000000000000004', '', '00000000000000000000000000000002', 'PROCESSMAKER_MANAGER', '2010-03-29 09:14:15', '2010-03-29 09:19:53', 1),
|
||||||
|
('00000000000000000000000000000005', '', '00000000000000000000000000000002', 'PROCESSMAKER_GUEST', '2009-02-01 12:24:36', '2009-02-01 12:24:36', 1);
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `RBAC_ROLES_PERMISSIONS` VALUES
|
INSERT INTO `RBAC_ROLES_PERMISSIONS` VALUES
|
||||||
@@ -213,8 +215,11 @@ INSERT INTO `RBAC_ROLES_PERMISSIONS` VALUES
|
|||||||
('00000000000000000000000000000004','00000000000000000000000000000060'),
|
('00000000000000000000000000000004','00000000000000000000000000000060'),
|
||||||
('00000000000000000000000000000004','00000000000000000000000000000061'),
|
('00000000000000000000000000000004','00000000000000000000000000000061'),
|
||||||
('00000000000000000000000000000004','00000000000000000000000000000062'),
|
('00000000000000000000000000000004','00000000000000000000000000000062'),
|
||||||
('00000000000000000000000000000004','00000000000000000000000000000063');
|
('00000000000000000000000000000004','00000000000000000000000000000063'),
|
||||||
|
('00000000000000000000000000000005','00000000000000000000000000000066');
|
||||||
|
|
||||||
INSERT INTO `RBAC_SYSTEMS` VALUES ('00000000000000000000000000000001','RBAC','2007-07-31 19:10:22','2007-08-03 12:24:36',1),('00000000000000000000000000000002','PROCESSMAKER','2007-07-31 19:10:22','2007-08-03 12:24:36',1);
|
INSERT INTO `RBAC_SYSTEMS` VALUES ('00000000000000000000000000000001','RBAC','2007-07-31 19:10:22','2007-08-03 12:24:36',1),('00000000000000000000000000000002','PROCESSMAKER','2007-07-31 19:10:22','2007-08-03 12:24:36',1);
|
||||||
INSERT INTO `RBAC_USERS` VALUES ('00000000000000000000000000000001','admin','21232f297a57a5a743894a0e4a801fc3','Administrator','','admin@processmaker.com','2020-01-01','2007-08-03 12:24:36','2008-02-13 07:24:07',1,'MYSQL','00000000000000000000000000000000','','');
|
INSERT INTO `RBAC_USERS` VALUES ('00000000000000000000000000000001','admin','21232f297a57a5a743894a0e4a801fc3','Administrator','','admin@processmaker.com','2020-01-01','2007-08-03 12:24:36','2008-02-13 07:24:07',1,'MYSQL','00000000000000000000000000000000','',''),
|
||||||
INSERT INTO `RBAC_USERS_ROLES` VALUES ('00000000000000000000000000000001','00000000000000000000000000000002');
|
('00000000000000000000000000000002','guest','674ba9750749d735ec9787d606170d78','Guest','','guest@processmaker.com','2200-01-01','2009-02-01 12:24:36','2009-02-01 12:24:36',0,'MYSQL','00000000000000000000000000000000','','');
|
||||||
|
INSERT INTO `RBAC_USERS_ROLES` VALUES ('00000000000000000000000000000001','00000000000000000000000000000002'),
|
||||||
|
('00000000000000000000000000000002','00000000000000000000000000000005');
|
||||||
|
|||||||
@@ -77,28 +77,38 @@ class Groups
|
|||||||
/**
|
/**
|
||||||
* Set a user to group
|
* Set a user to group
|
||||||
*
|
*
|
||||||
* @param string $GrpUid, $UsrUid
|
* @param string $grpUid
|
||||||
* @return array
|
* @param string $usrUid
|
||||||
|
* @return boolean
|
||||||
|
* @throws exception
|
||||||
*/
|
*/
|
||||||
public function addUserToGroup($GrpUid, $UsrUid)
|
public function addUserToGroup($grpUid, $usrUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oGrp = GroupUserPeer::retrieveByPk($GrpUid, $UsrUid);
|
//Check the usrUid value
|
||||||
if (is_object($oGrp) && get_class($oGrp) == 'GroupUser') {
|
if (RBAC::isGuestUserUid($usrUid)) {
|
||||||
|
throw new Exception(G::LoadTranslation("ID_USER_CAN_NOT_UPDATE", array($usrUid)));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$groupUser = GroupUserPeer::retrieveByPk($grpUid, $usrUid);
|
||||||
|
if (is_object($groupUser) && get_class($groupUser) == 'GroupUser') {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
$oGrp = new GroupUser();
|
$groupUser = new GroupUser();
|
||||||
$oGrp->setGrpUid($GrpUid);
|
$groupUser->setGrpUid($grpUid);
|
||||||
$oGrp->setUsrUid($UsrUid);
|
$groupUser->setUsrUid($usrUid);
|
||||||
$oGrp->Save();
|
$groupUser->Save();
|
||||||
|
|
||||||
$oGrpwf = new Groupwf();
|
$groupWf = new Groupwf();
|
||||||
$grpName = $oGrpwf->loadByGroupUid($GrpUid);
|
$grpName = $groupWf->loadByGroupUid($grpUid);
|
||||||
|
|
||||||
$oUsr = new Users();
|
$users = new Users();
|
||||||
$usrName = $oUsr->load($UsrUid);
|
$usrName = $users->load($usrUid);
|
||||||
|
|
||||||
G::auditLog("AssignUserToGroup", "Assign user ". $usrName['USR_USERNAME'] ." (".$UsrUid.") to group ".$grpName['CON_VALUE']." (".$GrpUid.") ");
|
G::auditLog("AssignUserToGroup", "Assign user ". $usrName['USR_USERNAME'] ." (".$usrUid.") to group ".$grpName['CON_VALUE']." (".$grpUid.") ");
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
} catch (exception $oError) {
|
} catch (exception $oError) {
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
@@ -107,13 +117,14 @@ class Groups
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a user from group
|
* Remove a user from group
|
||||||
* @param string $GrpUid, $UsrUid
|
* @param string $grpUid
|
||||||
|
* @param string $usrUid
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function removeUserOfGroup($GrpUid, $UsrUid)
|
public function removeUserOfGroup($grpUid, $usrUid)
|
||||||
{
|
{
|
||||||
$gu = new GroupUser();
|
$gu = new GroupUser();
|
||||||
$gu->remove($GrpUid, $UsrUid);
|
$gu->remove($grpUid, $usrUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class WsBase
|
|||||||
$RBAC->loadUserRolePermission($RBAC->sSystem, $uid);
|
$RBAC->loadUserRolePermission($RBAC->sSystem, $uid);
|
||||||
$res = $RBAC->userCanAccess("PM_LOGIN");
|
$res = $RBAC->userCanAccess("PM_LOGIN");
|
||||||
|
|
||||||
if ($res != 1) {
|
if ($res != 1 && $uid !== RBAC::GUEST_USER_UID) {
|
||||||
$wsResponse = new WsResponse(2, G::loadTranslation('ID_USER_HAVENT_RIGHTS_SYSTEM'));
|
$wsResponse = new WsResponse(2, G::loadTranslation('ID_USER_HAVENT_RIGHTS_SYSTEM'));
|
||||||
throw (new Exception(serialize($wsResponse)));
|
throw (new Exception(serialize($wsResponse)));
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ class WsBase
|
|||||||
public function processList()
|
public function processList()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$result = array();
|
$result = [];
|
||||||
$oCriteria = new Criteria('workflow');
|
$oCriteria = new Criteria('workflow');
|
||||||
$oCriteria->add(ProcessPeer::PRO_STATUS, 'DISABLED', Criteria::NOT_EQUAL);
|
$oCriteria->add(ProcessPeer::PRO_STATUS, 'DISABLED', Criteria::NOT_EQUAL);
|
||||||
$oDataset = ProcessPeer::doSelectRS($oCriteria);
|
$oDataset = ProcessPeer::doSelectRS($oCriteria);
|
||||||
@@ -142,7 +142,7 @@ class WsBase
|
|||||||
public function roleList()
|
public function roleList()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$result = array();
|
$result = [];
|
||||||
|
|
||||||
$RBAC = & RBAC::getSingleton();
|
$RBAC = & RBAC::getSingleton();
|
||||||
$RBAC->initRBAC();
|
$RBAC->initRBAC();
|
||||||
@@ -195,7 +195,7 @@ class WsBase
|
|||||||
}
|
}
|
||||||
$rs = GroupwfPeer::doSelectRS($criteria);
|
$rs = GroupwfPeer::doSelectRS($criteria);
|
||||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$result = array();
|
$result = [];
|
||||||
while ($rs->next()) {
|
while ($rs->next()) {
|
||||||
$rows = $rs->getRow();
|
$rows = $rs->getRow();
|
||||||
$result[] = array('guid' => $rows['GRP_UID'], 'name' => $rows['GRP_TITLE']);
|
$result[] = array('guid' => $rows['GRP_UID'], 'name' => $rows['GRP_TITLE']);
|
||||||
@@ -216,7 +216,7 @@ class WsBase
|
|||||||
public function departmentList()
|
public function departmentList()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$result = array();
|
$result = [];
|
||||||
$oCriteria = new Criteria('workflow');
|
$oCriteria = new Criteria('workflow');
|
||||||
$oCriteria->add(DepartmentPeer::DEP_STATUS, 'ACTIVE');
|
$oCriteria->add(DepartmentPeer::DEP_STATUS, 'ACTIVE');
|
||||||
$oDataset = DepartmentPeer::doSelectRS($oCriteria);
|
$oDataset = DepartmentPeer::doSelectRS($oCriteria);
|
||||||
@@ -283,9 +283,9 @@ class WsBase
|
|||||||
|
|
||||||
if ($solrEnabled == 1) {
|
if ($solrEnabled == 1) {
|
||||||
try {
|
try {
|
||||||
$arrayData = array();
|
$arrayData = [];
|
||||||
|
|
||||||
$delegationIndexes = array();
|
$delegationIndexes = [];
|
||||||
$columsToInclude = array("APP_UID");
|
$columsToInclude = array("APP_UID");
|
||||||
$solrSearchText = null;
|
$solrSearchText = null;
|
||||||
|
|
||||||
@@ -323,7 +323,7 @@ class WsBase
|
|||||||
$solrQueryResult = $searchIndex->getDataTablePaginatedList($solrRequestData);
|
$solrQueryResult = $searchIndex->getDataTablePaginatedList($solrRequestData);
|
||||||
|
|
||||||
//Get the missing data from database
|
//Get the missing data from database
|
||||||
$arrayApplicationUid = array();
|
$arrayApplicationUid = [];
|
||||||
|
|
||||||
foreach ($solrQueryResult->aaData as $i => $data) {
|
foreach ($solrQueryResult->aaData as $i => $data) {
|
||||||
$arrayApplicationUid[] = $data["APP_UID"];
|
$arrayApplicationUid[] = $data["APP_UID"];
|
||||||
@@ -333,7 +333,7 @@ class WsBase
|
|||||||
|
|
||||||
foreach ($solrQueryResult->aaData as $i => $data) {
|
foreach ($solrQueryResult->aaData as $i => $data) {
|
||||||
//Initialize array
|
//Initialize array
|
||||||
$delIndexes = array(); //Store all the delegation indexes
|
$delIndexes = []; //Store all the delegation indexes
|
||||||
//Complete empty values
|
//Complete empty values
|
||||||
$applicationUid = $data["APP_UID"]; //APP_UID
|
$applicationUid = $data["APP_UID"]; //APP_UID
|
||||||
//Get all the indexes returned by Solr as columns
|
//Get all the indexes returned by Solr as columns
|
||||||
@@ -357,7 +357,7 @@ class WsBase
|
|||||||
|
|
||||||
//Get records
|
//Get records
|
||||||
foreach ($delIndexes as $delIndex) {
|
foreach ($delIndexes as $delIndex) {
|
||||||
$aRow = array();
|
$aRow = [];
|
||||||
|
|
||||||
//Copy result values to new row from Solr server
|
//Copy result values to new row from Solr server
|
||||||
$aRow["APP_UID"] = $data["APP_UID"];
|
$aRow["APP_UID"] = $data["APP_UID"];
|
||||||
@@ -394,7 +394,7 @@ class WsBase
|
|||||||
|
|
||||||
return $arrayData;
|
return $arrayData;
|
||||||
} catch (InvalidIndexSearchTextException $e) {
|
} catch (InvalidIndexSearchTextException $e) {
|
||||||
$arrayData = array();
|
$arrayData = [];
|
||||||
|
|
||||||
$arrayData[] = array(
|
$arrayData[] = array(
|
||||||
"guid" => $e->getMessage(),
|
"guid" => $e->getMessage(),
|
||||||
@@ -407,7 +407,7 @@ class WsBase
|
|||||||
return $arrayData;
|
return $arrayData;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$arrayData = array();
|
$arrayData = [];
|
||||||
|
|
||||||
$criteria = new Criteria("workflow");
|
$criteria = new Criteria("workflow");
|
||||||
|
|
||||||
@@ -452,7 +452,7 @@ class WsBase
|
|||||||
return $arrayData;
|
return $arrayData;
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$arrayData = array();
|
$arrayData = [];
|
||||||
|
|
||||||
$arrayData[] = array(
|
$arrayData[] = array(
|
||||||
"guid" => $e->getMessage(),
|
"guid" => $e->getMessage(),
|
||||||
@@ -475,7 +475,7 @@ class WsBase
|
|||||||
public function unassignedCaseList($userId)
|
public function unassignedCaseList($userId)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$result = array();
|
$result = [];
|
||||||
$oAppCache = new AppCacheView();
|
$oAppCache = new AppCacheView();
|
||||||
$Criteria = $oAppCache->getUnassignedListCriteria($userId);
|
$Criteria = $oAppCache->getUnassignedListCriteria($userId);
|
||||||
$oDataset = AppCacheViewPeer::doSelectRS($Criteria);
|
$oDataset = AppCacheViewPeer::doSelectRS($Criteria);
|
||||||
@@ -504,30 +504,34 @@ class WsBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get all groups
|
* Get all users
|
||||||
*
|
*
|
||||||
* @param none
|
* @param none
|
||||||
* @return $result will return an object
|
* @return array $result, will return an array
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function userList()
|
public function userList()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$result = array();
|
$result = [];
|
||||||
$oCriteria = new Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
$oCriteria->add(UsersPeer::USR_STATUS, 'ACTIVE');
|
$criteria->add(UsersPeer::USR_STATUS, 'ACTIVE');
|
||||||
$oDataset = UsersPeer::doSelectRS($oCriteria);
|
$criteria->add(UsersPeer::USR_UID, [RBAC::GUEST_USER_UID], Criteria::NOT_IN);
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$dataset = UsersPeer::doSelectRS($criteria);
|
||||||
$oDataset->next();
|
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
$dataset->next();
|
||||||
|
|
||||||
while ($aRow = $oDataset->getRow()) {
|
while ($row = $dataset->getRow()) {
|
||||||
$result[] = array('guid' => $aRow['USR_UID'], 'name' => $aRow['USR_USERNAME']);
|
$result[] = ['guid' => $row['USR_UID'], 'name' => $row['USR_USERNAME']];
|
||||||
$oDataset->next();
|
$dataset->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$result[] = array('guid' => $e->getMessage(), 'name' => $e->getMessage()
|
$result[] = [
|
||||||
);
|
'guid' => $e->getMessage(),
|
||||||
|
'name' => $e->getMessage()
|
||||||
|
];
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@@ -542,7 +546,7 @@ class WsBase
|
|||||||
public function triggerList()
|
public function triggerList()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$result = array();
|
$result = [];
|
||||||
$oCriteria = new Criteria('workflow');
|
$oCriteria = new Criteria('workflow');
|
||||||
$oCriteria->addSelectColumn(TriggersPeer::TRI_UID);
|
$oCriteria->addSelectColumn(TriggersPeer::TRI_UID);
|
||||||
$oCriteria->addSelectColumn(TriggersPeer::PRO_UID);
|
$oCriteria->addSelectColumn(TriggersPeer::PRO_UID);
|
||||||
@@ -583,12 +587,12 @@ class WsBase
|
|||||||
$sTaskUID = '';
|
$sTaskUID = '';
|
||||||
$oCriteria = $oCase->getAllUploadedDocumentsCriteria($sProcessUID, $sApplicationUID, $sTaskUID, $sUserUID);
|
$oCriteria = $oCase->getAllUploadedDocumentsCriteria($sProcessUID, $sApplicationUID, $sTaskUID, $sUserUID);
|
||||||
|
|
||||||
$result = array();
|
$result = [];
|
||||||
global $_DBArray;
|
global $_DBArray;
|
||||||
|
|
||||||
foreach ($_DBArray['inputDocuments'] as $key => $row) {
|
foreach ($_DBArray['inputDocuments'] as $key => $row) {
|
||||||
if (isset($row['DOC_VERSION'])) {
|
if (isset($row['DOC_VERSION'])) {
|
||||||
$docrow = array();
|
$docrow = [];
|
||||||
$docrow['guid'] = $row['APP_DOC_UID'];
|
$docrow['guid'] = $row['APP_DOC_UID'];
|
||||||
$docrow['filename'] = $row['APP_DOC_FILENAME'];
|
$docrow['filename'] = $row['APP_DOC_FILENAME'];
|
||||||
$docrow['docId'] = $row['DOC_UID'];
|
$docrow['docId'] = $row['DOC_UID'];
|
||||||
@@ -630,7 +634,7 @@ class WsBase
|
|||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
|
|
||||||
$result = array();
|
$result = [];
|
||||||
|
|
||||||
while ($aRow = $oDataset->getRow()) {
|
while ($aRow = $oDataset->getRow()) {
|
||||||
if ($aRow['INP_DOC_TITLE'] == null) {
|
if ($aRow['INP_DOC_TITLE'] == null) {
|
||||||
@@ -641,7 +645,7 @@ class WsBase
|
|||||||
$aRow['INP_DOC_DESCRIPTION'] = $inputDocumentObj['INP_DOC_DESCRIPTION'];
|
$aRow['INP_DOC_DESCRIPTION'] = $inputDocumentObj['INP_DOC_DESCRIPTION'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$docrow = array();
|
$docrow = [];
|
||||||
$docrow['guid'] = $aRow['INP_DOC_UID'];
|
$docrow['guid'] = $aRow['INP_DOC_UID'];
|
||||||
$docrow['name'] = $aRow['INP_DOC_TITLE'];
|
$docrow['name'] = $aRow['INP_DOC_TITLE'];
|
||||||
$docrow['description'] = $aRow['INP_DOC_DESCRIPTION'];
|
$docrow['description'] = $aRow['INP_DOC_DESCRIPTION'];
|
||||||
@@ -674,12 +678,12 @@ class WsBase
|
|||||||
$sTaskUID = '';
|
$sTaskUID = '';
|
||||||
$oCriteria = $oCase->getAllGeneratedDocumentsCriteria($sProcessUID, $sApplicationUID, $sTaskUID, $sUserUID);
|
$oCriteria = $oCase->getAllGeneratedDocumentsCriteria($sProcessUID, $sApplicationUID, $sTaskUID, $sUserUID);
|
||||||
|
|
||||||
$result = array();
|
$result = [];
|
||||||
global $_DBArray;
|
global $_DBArray;
|
||||||
|
|
||||||
foreach ($_DBArray['outputDocuments'] as $key => $row) {
|
foreach ($_DBArray['outputDocuments'] as $key => $row) {
|
||||||
if (isset($row['DOC_VERSION'])) {
|
if (isset($row['DOC_VERSION'])) {
|
||||||
$docrow = array();
|
$docrow = [];
|
||||||
$docrow['guid'] = $row['APP_DOC_UID'];
|
$docrow['guid'] = $row['APP_DOC_UID'];
|
||||||
$docrow['filename'] = $row['DOWNLOAD_FILE'];
|
$docrow['filename'] = $row['DOWNLOAD_FILE'];
|
||||||
|
|
||||||
@@ -736,7 +740,7 @@ class WsBase
|
|||||||
$oGroup = new Groups();
|
$oGroup = new Groups();
|
||||||
$aGroups = $oGroup->getActiveGroupsForAnUser($userId);
|
$aGroups = $oGroup->getActiveGroupsForAnUser($userId);
|
||||||
|
|
||||||
$result = array();
|
$result = [];
|
||||||
$oCriteria = new Criteria('workflow');
|
$oCriteria = new Criteria('workflow');
|
||||||
$del = DBAdapter::getStringDelimiter();
|
$del = DBAdapter::getStringDelimiter();
|
||||||
$oCriteria->addSelectColumn(TaskPeer::PRO_UID);
|
$oCriteria->addSelectColumn(TaskPeer::PRO_UID);
|
||||||
@@ -787,13 +791,13 @@ class WsBase
|
|||||||
* @return $result will return an object
|
* @return $result will return an object
|
||||||
*/
|
*/
|
||||||
public function sendMessage(
|
public function sendMessage(
|
||||||
$caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplate, $appFields = null, $aAttachment = null, $showMessage = true, $delIndex = 0, $config = array(), $gmail = 0
|
$caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplate, $appFields = null, $aAttachment = null, $showMessage = true, $delIndex = 0, $config = [], $gmail = 0
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
if (!empty($config)) {
|
if (!empty($config)) {
|
||||||
$arrayConfigAux = array();
|
$arrayConfigAux = [];
|
||||||
|
|
||||||
if (is_array($config)) {
|
if (is_array($config)) {
|
||||||
if (PMLicensedFeatures::getSingleton()->verifyfeature("nKaNTNuT1MzK0RsMEtXTnYzR09ucHF2WGNuS0hRdDBBak42WXJhNVVOOG1INEVoaU1EaTllbjBBeEJNeG9wRVJ6NmxQelhyVTBvdThzPQ==")) {
|
if (PMLicensedFeatures::getSingleton()->verifyfeature("nKaNTNuT1MzK0RsMEtXTnYzR09ucHF2WGNuS0hRdDBBak42WXJhNVVOOG1INEVoaU1EaTllbjBBeEJNeG9wRVJ6NmxQelhyVTBvdThzPQ==")) {
|
||||||
@@ -962,7 +966,7 @@ class WsBase
|
|||||||
|
|
||||||
$oDataset = AppDelayPeer::doSelectRS($oCriteria);
|
$oDataset = AppDelayPeer::doSelectRS($oCriteria);
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$aIndexsPaused = array();
|
$aIndexsPaused = [];
|
||||||
while ($oDataset->next()) {
|
while ($oDataset->next()) {
|
||||||
$data = $oDataset->getRow();
|
$data = $oDataset->getRow();
|
||||||
$aIndexsPaused[] = $data['APP_DEL_INDEX'];
|
$aIndexsPaused[] = $data['APP_DEL_INDEX'];
|
||||||
@@ -993,7 +997,7 @@ class WsBase
|
|||||||
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
|
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
$aCurrentUsers = array();
|
$aCurrentUsers = [];
|
||||||
|
|
||||||
while ($oDataset->next()) {
|
while ($oDataset->next()) {
|
||||||
$aAppDel = $oDataset->getRow();
|
$aAppDel = $oDataset->getRow();
|
||||||
@@ -1114,7 +1118,7 @@ class WsBase
|
|||||||
$strRole = $role;
|
$strRole = $role;
|
||||||
|
|
||||||
if ($RBAC->verifyByCode($role) == 0) {
|
if ($RBAC->verifyByCode($role) == 0) {
|
||||||
$data = array();
|
$data = [];
|
||||||
$data["ROLE"] = $role;
|
$data["ROLE"] = $role;
|
||||||
|
|
||||||
$result = new WsCreateUserResponse(6, G::loadTranslation("ID_INVALID_ROLE", SYS_LANG, $data), null);
|
$result = new WsCreateUserResponse(6, G::loadTranslation("ID_INVALID_ROLE", SYS_LANG, $data), null);
|
||||||
@@ -1130,7 +1134,7 @@ class WsBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($RBAC->verifyUser($userName) == 1) {
|
if ($RBAC->verifyUser($userName) == 1) {
|
||||||
$data = array();
|
$data = [];
|
||||||
$data["USER_ID"] = $userName;
|
$data["USER_ID"] = $userName;
|
||||||
|
|
||||||
$result = new WsCreateUserResponse(7, G::loadTranslation("ID_USERNAME_ALREADY_EXISTS", SYS_LANG, $data), null);
|
$result = new WsCreateUserResponse(7, G::loadTranslation("ID_USERNAME_ALREADY_EXISTS", SYS_LANG, $data), null);
|
||||||
@@ -1139,7 +1143,7 @@ class WsBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Set fields
|
//Set fields
|
||||||
$arrayData = array();
|
$arrayData = [];
|
||||||
|
|
||||||
$arrayData["USR_USERNAME"] = $userName;
|
$arrayData["USR_USERNAME"] = $userName;
|
||||||
$arrayData["USR_PASSWORD"] = Bootstrap::hashPassword($password);
|
$arrayData["USR_PASSWORD"] = Bootstrap::hashPassword($password);
|
||||||
@@ -1175,7 +1179,7 @@ class WsBase
|
|||||||
$user->create($arrayData);
|
$user->create($arrayData);
|
||||||
|
|
||||||
//Response
|
//Response
|
||||||
$data = array();
|
$data = [];
|
||||||
$data["FIRSTNAME"] = $firstName;
|
$data["FIRSTNAME"] = $firstName;
|
||||||
$data["LASTNAME"] = $lastName;
|
$data["LASTNAME"] = $lastName;
|
||||||
$data["USER_ID"] = $userName;
|
$data["USER_ID"] = $userName;
|
||||||
@@ -1265,7 +1269,7 @@ class WsBase
|
|||||||
$strRole = $role;
|
$strRole = $role;
|
||||||
|
|
||||||
if ($RBAC->verifyByCode($role) == 0) {
|
if ($RBAC->verifyByCode($role) == 0) {
|
||||||
$data = array();
|
$data = [];
|
||||||
$data["ROLE"] = $role;
|
$data["ROLE"] = $role;
|
||||||
|
|
||||||
$result = new WsResponse(6, G::LoadTranslation("ID_INVALID_ROLE", SYS_LANG, $data));
|
$result = new WsResponse(6, G::LoadTranslation("ID_INVALID_ROLE", SYS_LANG, $data));
|
||||||
@@ -1288,7 +1292,7 @@ class WsBase
|
|||||||
$rs = UsersPeer::doSelectRS($criteria);
|
$rs = UsersPeer::doSelectRS($criteria);
|
||||||
|
|
||||||
if ($rs->next()) {
|
if ($rs->next()) {
|
||||||
$data = array();
|
$data = [];
|
||||||
$data["USER_ID"] = $userName;
|
$data["USER_ID"] = $userName;
|
||||||
|
|
||||||
$result = new WsResponse(7, G::LoadTranslation("ID_USERNAME_ALREADY_EXISTS", SYS_LANG, $data));
|
$result = new WsResponse(7, G::LoadTranslation("ID_USERNAME_ALREADY_EXISTS", SYS_LANG, $data));
|
||||||
@@ -1297,7 +1301,7 @@ class WsBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Set fields
|
//Set fields
|
||||||
$arrayData = array();
|
$arrayData = [];
|
||||||
|
|
||||||
$arrayData["USR_UID"] = $userUid;
|
$arrayData["USR_UID"] = $userUid;
|
||||||
$arrayData["USR_USERNAME"] = $userName;
|
$arrayData["USR_USERNAME"] = $userName;
|
||||||
@@ -1695,7 +1699,7 @@ class WsBase
|
|||||||
|
|
||||||
$caseFields = $oCase->loadCase($caseId);
|
$caseFields = $oCase->loadCase($caseId);
|
||||||
$oldFields = $caseFields['APP_DATA'];
|
$oldFields = $caseFields['APP_DATA'];
|
||||||
$resFields = array();
|
$resFields = [];
|
||||||
|
|
||||||
foreach ($variables as $key => $val) {
|
foreach ($variables as $key => $val) {
|
||||||
$a .= $val->name . ', ';
|
$a .= $val->name . ', ';
|
||||||
@@ -1763,7 +1767,7 @@ class WsBase
|
|||||||
$caseFields = $oCase->loadCase($caseId);
|
$caseFields = $oCase->loadCase($caseId);
|
||||||
|
|
||||||
$oldFields = $caseFields['APP_DATA'];
|
$oldFields = $caseFields['APP_DATA'];
|
||||||
$resFields = array();
|
$resFields = [];
|
||||||
|
|
||||||
foreach ($oldFields as $key => $val) {
|
foreach ($oldFields as $key => $val) {
|
||||||
$node = new stdClass();
|
$node = new stdClass();
|
||||||
@@ -1805,7 +1809,7 @@ class WsBase
|
|||||||
$_SESSION["TASK"] = $taskId;
|
$_SESSION["TASK"] = $taskId;
|
||||||
$_SESSION["USER_LOGGED"] = $userId;
|
$_SESSION["USER_LOGGED"] = $userId;
|
||||||
|
|
||||||
$Fields = array();
|
$Fields = [];
|
||||||
|
|
||||||
if (is_array($variables) && count($variables) > 0) {
|
if (is_array($variables) && count($variables) > 0) {
|
||||||
$Fields = $variables;
|
$Fields = $variables;
|
||||||
@@ -2105,7 +2109,7 @@ class WsBase
|
|||||||
* @param bool $bExecuteTriggersBeforeAssignment
|
* @param bool $bExecuteTriggersBeforeAssignment
|
||||||
* @return $result will return an object
|
* @return $result will return an object
|
||||||
*/
|
*/
|
||||||
public function derivateCase($userId, $caseId, $delIndex, $bExecuteTriggersBeforeAssignment = false, $tasks = array())
|
public function derivateCase($userId, $caseId, $delIndex, $bExecuteTriggersBeforeAssignment = false, $tasks = [])
|
||||||
{
|
{
|
||||||
$g = new G();
|
$g = new G();
|
||||||
|
|
||||||
@@ -2119,7 +2123,7 @@ class WsBase
|
|||||||
//Define variables
|
//Define variables
|
||||||
$sStatus = 'TO_DO';
|
$sStatus = 'TO_DO';
|
||||||
$varResponse = '';
|
$varResponse = '';
|
||||||
$previousAppData = array();
|
$previousAppData = [];
|
||||||
|
|
||||||
if ($delIndex == '') {
|
if ($delIndex == '') {
|
||||||
$oCriteria = new Criteria('workflow');
|
$oCriteria = new Criteria('workflow');
|
||||||
@@ -2165,7 +2169,7 @@ class WsBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$aData = array();
|
$aData = [];
|
||||||
$aData['APP_UID'] = $caseId;
|
$aData['APP_UID'] = $caseId;
|
||||||
$aData['DEL_INDEX'] = $delIndex;
|
$aData['DEL_INDEX'] = $delIndex;
|
||||||
$aData['USER_UID'] = $userId;
|
$aData['USER_UID'] = $userId;
|
||||||
@@ -2221,7 +2225,7 @@ class WsBase
|
|||||||
|
|
||||||
foreach ($derive as $key => $val) {
|
foreach ($derive as $key => $val) {
|
||||||
//Routed to the next task, if end process then not exist user
|
//Routed to the next task, if end process then not exist user
|
||||||
$nodeNext = array();
|
$nodeNext = [];
|
||||||
$usrasgdUid = null;
|
$usrasgdUid = null;
|
||||||
$usrasgdUserName = null;
|
$usrasgdUserName = null;
|
||||||
|
|
||||||
@@ -2332,7 +2336,7 @@ class WsBase
|
|||||||
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
|
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
$aCurrentUsers = array();
|
$aCurrentUsers = [];
|
||||||
|
|
||||||
while ($oDataset->next()) {
|
while ($oDataset->next()) {
|
||||||
$aAppDel = $oDataset->getRow();
|
$aAppDel = $oDataset->getRow();
|
||||||
@@ -2469,7 +2473,7 @@ class WsBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
//executeTrigger
|
//executeTrigger
|
||||||
$aTriggers = array();
|
$aTriggers = [];
|
||||||
$c = new Criteria();
|
$c = new Criteria();
|
||||||
$c->add(TriggersPeer::TRI_UID, $triggerIndex);
|
$c->add(TriggersPeer::TRI_UID, $triggerIndex);
|
||||||
$rs = TriggersPeer::doSelectRS($c);
|
$rs = TriggersPeer::doSelectRS($c);
|
||||||
@@ -2531,7 +2535,7 @@ class WsBase
|
|||||||
*/
|
*/
|
||||||
public function taskCase($caseId)
|
public function taskCase($caseId)
|
||||||
{
|
{
|
||||||
$result = array();
|
$result = [];
|
||||||
try {
|
try {
|
||||||
$oCriteria = new Criteria('workflow');
|
$oCriteria = new Criteria('workflow');
|
||||||
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
$oCriteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||||
@@ -2574,7 +2578,7 @@ class WsBase
|
|||||||
try {
|
try {
|
||||||
$oCase = new Cases();
|
$oCase = new Cases();
|
||||||
$rows = $oCase->getStartCases($userId);
|
$rows = $oCase->getStartCases($userId);
|
||||||
$result = array();
|
$result = [];
|
||||||
|
|
||||||
foreach ($rows as $key => $val) {
|
foreach ($rows as $key => $val) {
|
||||||
if ($key != 0) {
|
if ($key != 0) {
|
||||||
@@ -2659,7 +2663,7 @@ class WsBase
|
|||||||
* ****************( 3 )*****************
|
* ****************( 3 )*****************
|
||||||
*/
|
*/
|
||||||
$oCriteria = new Criteria('workflow');
|
$oCriteria = new Criteria('workflow');
|
||||||
$aConditions = array();
|
$aConditions = [];
|
||||||
$oCriteria->add(AppDelegationPeer::APP_UID, $caseId);
|
$oCriteria->add(AppDelegationPeer::APP_UID, $caseId);
|
||||||
$oCriteria->add(AppDelegationPeer::USR_UID, $userIdSource);
|
$oCriteria->add(AppDelegationPeer::USR_UID, $userIdSource);
|
||||||
$oCriteria->add(AppDelegationPeer::DEL_INDEX, $delIndex);
|
$oCriteria->add(AppDelegationPeer::DEL_INDEX, $delIndex);
|
||||||
@@ -2790,10 +2794,10 @@ class WsBase
|
|||||||
try {
|
try {
|
||||||
$result = new wsGetCaseNotesResponse(0, G::loadTranslation('ID_SUCCESS'), Cases::getCaseNotes($applicationID, 'array', $userUid));
|
$result = new wsGetCaseNotesResponse(0, G::loadTranslation('ID_SUCCESS'), Cases::getCaseNotes($applicationID, 'array', $userUid));
|
||||||
|
|
||||||
$var = array();
|
$var = [];
|
||||||
|
|
||||||
foreach ($result->notes as $key => $value) {
|
foreach ($result->notes as $key => $value) {
|
||||||
$var2 = array();
|
$var2 = [];
|
||||||
|
|
||||||
foreach ($value as $keys => $values) {
|
foreach ($value as $keys => $values) {
|
||||||
$field = strtolower($keys);
|
$field = strtolower($keys);
|
||||||
|
|||||||
@@ -1,33 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* TaskUser.php
|
|
||||||
*
|
|
||||||
* @package workflow.engine.classes.model
|
|
||||||
*
|
|
||||||
* ProcessMaker Open Source Edition
|
|
||||||
* Copyright (C) 2004 - 2011 Colosa Inc.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
//require_once 'classes/model/om/BaseTaskUser.php';
|
|
||||||
//require_once 'classes/model/Content.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skeleton subclass for representing a row from the 'GROUP_USER' table.
|
* Skeleton subclass for representing a row from the 'GROUP_USER' table.
|
||||||
*
|
*
|
||||||
@@ -39,42 +10,59 @@
|
|||||||
*
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use ProcessMaker\BusinessModel\WebEntry;
|
||||||
class TaskUser extends BaseTaskUser
|
class TaskUser extends BaseTaskUser
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the application document registry
|
* Create the new record in the table TaskUser
|
||||||
*
|
*
|
||||||
* @param array $aData
|
* @param array $requestData
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws Exception
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function create ($aData)
|
public function create ($requestData)
|
||||||
{
|
{
|
||||||
$oConnection = Propel::getConnection( TaskUserPeer::DATABASE_NAME );
|
$connection = Propel::getConnection(TaskUserPeer::DATABASE_NAME);
|
||||||
try {
|
try {
|
||||||
$taskUser = TaskUserPeer::retrieveByPK( $aData['TAS_UID'], $aData['USR_UID'], $aData['TU_TYPE'], $aData['TU_RELATION'] );
|
$bmWebEntry = new WebEntry;
|
||||||
|
//Check the usrUid value
|
||||||
if (is_object( $taskUser )) {
|
if (RBAC::isGuestUserUid($requestData['USR_UID']) && !$bmWebEntry->isTaskAWebEntry($requestData['TAS_UID'])) {
|
||||||
return - 1;
|
throw new Exception(G::LoadTranslation("ID_USER_CAN_NOT_UPDATE", array($requestData['USR_UID'])));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
$oTaskUser = new TaskUser();
|
|
||||||
$oTaskUser->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
$taskUser = TaskUserPeer::retrieveByPK(
|
||||||
if ($oTaskUser->validate()) {
|
$requestData['TAS_UID'],
|
||||||
$oConnection->begin();
|
$requestData['USR_UID'],
|
||||||
$iResult = $oTaskUser->save();
|
$requestData['TU_TYPE'],
|
||||||
$oConnection->commit();
|
$requestData['TU_RELATION']
|
||||||
return $iResult;
|
);
|
||||||
|
|
||||||
|
if (is_object($taskUser)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$taskUser = new TaskUser();
|
||||||
|
$taskUser->fromArray($requestData, BasePeer::TYPE_FIELDNAME);
|
||||||
|
if ($taskUser->validate()) {
|
||||||
|
$connection->begin();
|
||||||
|
$result = $taskUser->save();
|
||||||
|
$connection->commit();
|
||||||
|
|
||||||
|
return $result;
|
||||||
} else {
|
} else {
|
||||||
$sMessage = '';
|
$message = '';
|
||||||
$aValidationFailures = $oTaskUser->getValidationFailures();
|
$aValidationFailures = $taskUser->getValidationFailures();
|
||||||
foreach ($aValidationFailures as $oValidationFailure) {
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
$message .= $oValidationFailure->getMessage() . '<br />';
|
||||||
}
|
}
|
||||||
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
throw (new Exception('The registry cannot be created!<br />' . $message));
|
||||||
}
|
}
|
||||||
} catch (Exception $oError) {
|
} catch (Exception $oError) {
|
||||||
$oConnection->rollback();
|
$connection->rollback();
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -281,10 +281,20 @@ class Users extends BaseUsers
|
|||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all information about the user
|
||||||
|
* @param string $userUid
|
||||||
|
* @return array $arrayData
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
public function getAllInformation ($userUid)
|
public function getAllInformation ($userUid)
|
||||||
{
|
{
|
||||||
if (! isset( $userUid ) || $userUid == "") {
|
if (!isset($userUid) || empty($userUid)) {
|
||||||
throw (new Exception( "$userUid is empty." ));
|
throw (new Exception('$userUid is empty.'));
|
||||||
|
}
|
||||||
|
if (RBAC::isGuestUserUid($userUid)) {
|
||||||
|
throw new Exception(G::LoadTranslation("ID_USER_CAN_NOT_UPDATE", array($userUid)));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
INSERT INTO USERS (USR_UID,USR_USERNAME,USR_PASSWORD,USR_FIRSTNAME,USR_LASTNAME,USR_EMAIL,USR_DUE_DATE,USR_CREATE_DATE,USR_UPDATE_DATE,USR_STATUS,USR_COUNTRY,USR_CITY,USR_LOCATION,USR_ADDRESS,USR_PHONE,USR_FAX,USR_CELLULAR,USR_ZIP_CODE,DEP_UID,USR_POSITION,USR_RESUME,USR_BIRTHDAY,USR_ROLE,USR_REPORTS_TO,USR_REPLACED_BY ) VALUES
|
INSERT INTO USERS (USR_UID,USR_USERNAME,USR_PASSWORD,USR_FIRSTNAME,USR_LASTNAME,USR_EMAIL,USR_DUE_DATE,USR_CREATE_DATE,USR_UPDATE_DATE,USR_STATUS,USR_COUNTRY,USR_CITY,USR_LOCATION,USR_ADDRESS,USR_PHONE,USR_FAX,USR_CELLULAR,USR_ZIP_CODE,DEP_UID,USR_POSITION,USR_RESUME,USR_BIRTHDAY,USR_ROLE,USR_REPORTS_TO,USR_REPLACED_BY ) VALUES
|
||||||
('00000000000000000000000000000001','admin','21232f297a57a5a743894a0e4a801fc3','Administrator',' ', 'admin@processmaker.com','2020-01-01','1999-11-30 00:00:00','2008-05-23 18:36:19','ACTIVE', 'US','FL','MMK','','', '1-305-402-0282','1-305-675-1400','','','Administrator', '','1999-02-25','PROCESSMAKER_ADMIN','','');
|
('00000000000000000000000000000001','admin','21232f297a57a5a743894a0e4a801fc3','Administrator',' ', 'admin@processmaker.com','2020-01-01','1999-11-30 00:00:00','2008-05-23 18:36:19','ACTIVE', 'US','FL','MMK','','', '1-305-402-0282','1-305-675-1400','','','Administrator', '','1999-02-25','PROCESSMAKER_ADMIN','',''),
|
||||||
|
('00000000000000000000000000000002','guest','674ba9750749d735ec9787d606170d78','Guest',' ', 'guest@processmaker.com','2200-01-01','2009-02-01 12:24:36','2009-02-01 12:24:36','INACTIVE', 'US','FL','MMK','','', '1-305-402-0282','1-305-675-1400','','','Guest', '','2009-02-01','PROCESSMAKER_GUEST','','');
|
||||||
|
|
||||||
INSERT INTO CONTENT (CON_CATEGORY,CON_PARENT,CON_ID,CON_LANG,CON_VALUE) VALUES
|
INSERT INTO CONTENT (CON_CATEGORY,CON_PARENT,CON_ID,CON_LANG,CON_VALUE) VALUES
|
||||||
('ROL_NAME','','00000000000000000000000000000002','en','System Administrator'),
|
('ROL_NAME','','00000000000000000000000000000002','en','System Administrator'),
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ if ($actionAjax == "userValues") {
|
|||||||
$cUsers->addSelectColumn(UsersPeer::USR_ID);
|
$cUsers->addSelectColumn(UsersPeer::USR_ID);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
$cUsers->add(UsersPeer::USR_UID, [RBAC::GUEST_USER_UID], Criteria::NOT_IN);
|
||||||
$cUsers->add(UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL);
|
$cUsers->add(UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL);
|
||||||
if (!is_null($query)) {
|
if (!is_null($query)) {
|
||||||
$filters = $cUsers->getNewCriterion(UsersPeer::USR_FIRSTNAME, '%' . $query . '%', Criteria::LIKE)->addOr(
|
$filters = $cUsers->getNewCriterion(UsersPeer::USR_FIRSTNAME, '%' . $query . '%', Criteria::LIKE)->addOr(
|
||||||
|
|||||||
@@ -1,38 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
$RBAC->requirePermissions('PM_CASES/strict');
|
||||||
* main.php Cases List main processor
|
|
||||||
*
|
|
||||||
* ProcessMaker Open Source Edition
|
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
|
||||||
*/
|
|
||||||
|
|
||||||
$RBAC->requirePermissions( 'PM_CASES' );
|
|
||||||
|
|
||||||
$G_MAIN_MENU = 'processmaker';
|
$G_MAIN_MENU = 'processmaker';
|
||||||
$G_ID_MENU_SELECTED = 'CASES';
|
$G_ID_MENU_SELECTED = 'CASES';
|
||||||
|
|
||||||
$_POST['qs'] = isset( $_SERVER['QUERY_STRING'] ) && $_SERVER['QUERY_STRING'] != '' ? '?' . $_SERVER['QUERY_STRING'] : '';
|
$_POST['qs'] = isset($_SERVER['QUERY_STRING'])
|
||||||
|
&& $_SERVER['QUERY_STRING'] != '' ? '?' . $_SERVER['QUERY_STRING'] : '';
|
||||||
|
|
||||||
$G_PUBLISH = new Publisher();
|
$G_PUBLISH = new Publisher();
|
||||||
$G_PUBLISH->AddContent( 'view', 'cases/cases_Load' );
|
$G_PUBLISH->AddContent('view', 'cases/cases_Load');
|
||||||
$oHeadPublisher = & headPublisher::getSingleton();
|
$oHeadPublisher = & headPublisher::getSingleton();
|
||||||
$oHeadPublisher->addScriptFile('/jscore/src/PM.js');
|
$oHeadPublisher->addScriptFile('/jscore/src/PM.js');
|
||||||
$oHeadPublisher->addScriptFile('/jscore/src/Sessions.js');
|
$oHeadPublisher->addScriptFile('/jscore/src/Sessions.js');
|
||||||
G::RenderPage( 'publish' );
|
G::RenderPage('publish');
|
||||||
|
|
||||||
|
|||||||
@@ -252,7 +252,8 @@ switch ($_POST['action']) {
|
|||||||
$subQuery = "SELECT " . GroupUserPeer::USR_UID .
|
$subQuery = "SELECT " . GroupUserPeer::USR_UID .
|
||||||
" FROM " . GroupUserPeer::TABLE_NAME .
|
" FROM " . GroupUserPeer::TABLE_NAME .
|
||||||
" WHERE " . GroupUserPeer::GRP_UID . " = '" .
|
" WHERE " . GroupUserPeer::GRP_UID . " = '" .
|
||||||
$inputFilter->quoteSmart($_REQUEST['gUID'], Propel::getConnection("workflow")) . "'";
|
$inputFilter->quoteSmart($_REQUEST['gUID'], Propel::getConnection("workflow")) . "'\n" .
|
||||||
|
"UNION SELECT '" . RBAC::GUEST_USER_UID . "'";
|
||||||
|
|
||||||
$aUsers = Array ();
|
$aUsers = Array ();
|
||||||
$oCriteria = new Criteria( 'workflow' );
|
$oCriteria = new Criteria( 'workflow' );
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ try {
|
|||||||
|
|
||||||
// Assign the uid of user to userloggedobj
|
// Assign the uid of user to userloggedobj
|
||||||
$RBAC->loadUserRolePermission($RBAC->sSystem, $uid);
|
$RBAC->loadUserRolePermission($RBAC->sSystem, $uid);
|
||||||
$res = $RBAC->userCanAccess('PM_LOGIN');
|
$res = $RBAC->userCanAccess('PM_LOGIN/strict');
|
||||||
if ($res != 1 ) {
|
if ($res != 1 ) {
|
||||||
if ($res == -2) {
|
if ($res == -2) {
|
||||||
G::SendTemporalMessage ('ID_USER_HAVENT_RIGHTS_SYSTEM', "error");
|
G::SendTemporalMessage ('ID_USER_HAVENT_RIGHTS_SYSTEM', "error");
|
||||||
|
|||||||
@@ -981,14 +981,7 @@ function ifPermission($sessionId, $permission)
|
|||||||
|
|
||||||
$oRBAC = RBAC::getSingleton();
|
$oRBAC = RBAC::getSingleton();
|
||||||
$oRBAC->loadUserRolePermission($oRBAC->sSystem, $user['USR_UID']);
|
$oRBAC->loadUserRolePermission($oRBAC->sSystem, $user['USR_UID']);
|
||||||
$aPermissions = $oRBAC->aUserInfo[$oRBAC->sSystem]['PERMISSIONS'];
|
$sw = $oRBAC->userCanAccess($permission) === 1 ? 1 : 0;
|
||||||
$sw = 0;
|
|
||||||
|
|
||||||
foreach ($aPermissions as $aPermission) {
|
|
||||||
if ($aPermission['PER_CODE'] == $permission) {
|
|
||||||
$sw = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $sw;
|
return $sw;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,33 +8,33 @@ global $RBAC;
|
|||||||
G::LoadClass('pmFunctions');
|
G::LoadClass('pmFunctions');
|
||||||
try {
|
try {
|
||||||
if (empty($_REQUEST['we_uid'])) {
|
if (empty($_REQUEST['we_uid'])) {
|
||||||
throw new \Exception('Missing required field "we_uid"');
|
throw new Exception('Missing required field "we_uid"');
|
||||||
}
|
}
|
||||||
|
|
||||||
$weUid = $_REQUEST['we_uid'];
|
$weUid = $_REQUEST['we_uid'];
|
||||||
|
|
||||||
$webEntry = \WebEntryPeer::retrieveByPK($weUid);
|
$webEntry = WebEntryPeer::retrieveByPK($weUid);
|
||||||
if (empty($webEntry)) {
|
if (empty($webEntry)) {
|
||||||
throw new \Exception('Undefined WebEntry');
|
throw new Exception('Undefined WebEntry');
|
||||||
}
|
}
|
||||||
|
|
||||||
$userUid = $webEntry->getUsrUid();
|
$userUid = $webEntry->getUsrUid();
|
||||||
$userInfo = PMFInformationUser($userUid);
|
$userInfo = UsersPeer::retrieveByPK($userUid);
|
||||||
if (empty($userInfo)) {
|
if (empty($userInfo)) {
|
||||||
throw new \Exception('WebEntry User not found');
|
throw new Exception('WebEntry User not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
initUserSession($userUid, $userInfo['username']);
|
initUserSession($userUid, $userInfo->getUsrUsername());
|
||||||
|
|
||||||
$result = [
|
$result = [
|
||||||
'user_logged' => $userUid,
|
'user_logged' => $userUid,
|
||||||
'userName' => $userInfo['username'],
|
'userName' => $userInfo->getUsrUsername(),
|
||||||
'firstName' => $userInfo['firstname'],
|
'firstName' => $userInfo->getUsrFirstName(),
|
||||||
'lastName' => $userInfo['lastname'],
|
'lastName' => $userInfo->getUsrLastName(),
|
||||||
'mail' => $userInfo['mail'],
|
'mail' => $userInfo->getUsrEmail(),
|
||||||
'image' => '../users/users_ViewPhoto?t='.microtime(true),
|
'image' => '../users/users_ViewPhoto?t='.microtime(true),
|
||||||
];
|
];
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
$result = [
|
$result = [
|
||||||
'error' => $e->getMessage(),
|
'error' => $e->getMessage(),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,31 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
$RBAC->requirePermissions('PM_DASHBOARD');
|
||||||
* dashboard.php
|
|
||||||
*
|
|
||||||
* ProcessMaker Open Source Edition
|
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
|
||||||
*/
|
|
||||||
|
|
||||||
$licensedFeatures = & PMLicensedFeatures::getSingleton();
|
$licensedFeatures = & PMLicensedFeatures::getSingleton();
|
||||||
if (!$licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjBsZEJ6dnpJa3dTeWVLVT0=')) {
|
if (!$licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjBsZEJ6dnpJa3dTeWVLVT0=')) {
|
||||||
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
|
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||||
G::header( 'location: ../login/login' );
|
G::header('location: ../login/login');
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,10 +11,10 @@ $G_MAIN_MENU = 'processmaker';
|
|||||||
$G_ID_MENU_SELECTED = 'DASHBOARD+';
|
$G_ID_MENU_SELECTED = 'DASHBOARD+';
|
||||||
|
|
||||||
$G_PUBLISH = new Publisher();
|
$G_PUBLISH = new Publisher();
|
||||||
$G_PUBLISH->AddContent( 'view', 'strategicDashboard/load' );
|
$G_PUBLISH->AddContent('view', 'strategicDashboard/load');
|
||||||
$oHeadPublisher = & headPublisher::getSingleton();
|
$oHeadPublisher = & headPublisher::getSingleton();
|
||||||
$oHeadPublisher->addScriptFile('/jscore/src/PM.js');
|
$oHeadPublisher->addScriptFile('/jscore/src/PM.js');
|
||||||
$oHeadPublisher->addScriptFile('/jscore/src/Sessions.js');
|
$oHeadPublisher->addScriptFile('/jscore/src/Sessions.js');
|
||||||
G::RenderPage( 'publish' );
|
G::RenderPage('publish');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
//Check guest user
|
||||||
|
if (isset($_GET['USR_UID']) && RBAC::isGuestUserUid($_GET['USR_UID'])) {
|
||||||
|
throw new Exception(G::LoadTranslation("ID_USER_CAN_NOT_UPDATE", array($_GET['USR_UID'])));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//calculating the max upload file size;
|
//calculating the max upload file size;
|
||||||
use ProcessMaker\Core\System;
|
use ProcessMaker\Core\System;
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,11 @@ try {
|
|||||||
$total = $webEntry->getWebEntryRelatedToUser($userUid);
|
$total = $webEntry->getWebEntryRelatedToUser($userUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check user guest
|
||||||
|
if (RBAC::isGuestUserUid($userUid)) {
|
||||||
|
$total++;
|
||||||
|
}
|
||||||
|
|
||||||
$response = '{success: true, candelete: ';
|
$response = '{success: true, candelete: ';
|
||||||
$response .= ($total > 0) ? 'false' : 'true';
|
$response .= ($total > 0) ? 'false' : 'true';
|
||||||
$response .= ', hashistory: ';
|
$response .= ', hashistory: ';
|
||||||
|
|||||||
@@ -1,14 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace ProcessMaker\BusinessModel;
|
namespace ProcessMaker\BusinessModel;
|
||||||
|
|
||||||
use \G;
|
use BasePeer;
|
||||||
use \UsersPeer;
|
use Configurations;
|
||||||
use \DepartmentPeer;
|
use Criteria;
|
||||||
|
use Department as DepartmentModel;
|
||||||
|
use DepartmentPeer;
|
||||||
|
use Exception;
|
||||||
|
use ProcessMaker\BusinessModel\Validator;
|
||||||
|
use Propel;
|
||||||
|
use RBAC;
|
||||||
|
use ResultSet;
|
||||||
|
use Users;
|
||||||
|
use UsersPeer;
|
||||||
|
use G;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
|
||||||
* @copyright Colosa - Bolivia
|
|
||||||
*/
|
|
||||||
class Department
|
class Department
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -16,27 +22,26 @@ class Department
|
|||||||
*
|
*
|
||||||
* @param string $departmentTitle Title
|
* @param string $departmentTitle Title
|
||||||
* @param string $departmentUidExclude Unique id of Department to exclude
|
* @param string $departmentUidExclude Unique id of Department to exclude
|
||||||
*
|
* @return bool Return true if exists the title of a Department, false otherwise
|
||||||
* return bool Return true if exists the title of a Department, false otherwise
|
|
||||||
*/
|
*/
|
||||||
public function existsTitle($departmentTitle, $departmentUidExclude = "")
|
public function existsTitle($departmentTitle, $departmentUidExclude = "")
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$criteria = new \Criteria("workflow");
|
$criteria = new Criteria("workflow");
|
||||||
|
|
||||||
$criteria->addSelectColumn(\DepartmentPeer::DEP_UID);
|
$criteria->addSelectColumn(DepartmentPeer::DEP_UID);
|
||||||
$criteria->addSelectColumn(\DepartmentPeer::DEP_TITLE);
|
$criteria->addSelectColumn(DepartmentPeer::DEP_TITLE);
|
||||||
|
|
||||||
if ($departmentUidExclude != "") {
|
if ($departmentUidExclude != "") {
|
||||||
$criteria->add(\DepartmentPeer::DEP_UID, $departmentUidExclude, \Criteria::NOT_EQUAL);
|
$criteria->add(DepartmentPeer::DEP_UID, $departmentUidExclude, Criteria::NOT_EQUAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$criteria->add(\DepartmentPeer::DEP_TITLE, $departmentTitle, \Criteria::EQUAL);
|
$criteria->add(DepartmentPeer::DEP_TITLE, $departmentTitle, Criteria::EQUAL);
|
||||||
|
|
||||||
$rsCriteria = \DepartmentPeer::doSelectRS($criteria);
|
$rsCriteria = DepartmentPeer::doSelectRS($criteria);
|
||||||
|
|
||||||
return ($rsCriteria->next())? true : false;
|
return ($rsCriteria->next())? true : false;
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,18 +51,17 @@ class Department
|
|||||||
*
|
*
|
||||||
* @param string $departmentUid
|
* @param string $departmentUid
|
||||||
* @param string $userUid
|
* @param string $userUid
|
||||||
*
|
* @return void Throw exception user not exists
|
||||||
* return void Throw exception user not exists
|
|
||||||
*/
|
*/
|
||||||
private function throwExceptionUserNotExistsInDepartment($departmentUid, $userUid)
|
private function throwExceptionUserNotExistsInDepartment($departmentUid, $userUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$user = \UsersPeer::retrieveByPK($userUid);
|
$user = UsersPeer::retrieveByPK($userUid);
|
||||||
|
|
||||||
if (is_null($user) || $user->getDepUid() != $departmentUid) {
|
if (is_null($user) || $user->getDepUid() != $departmentUid) {
|
||||||
throw new \Exception(\G::LoadTranslation('ID_USER_NOT_EXIST_DEPARTMENT', [$userUid]));
|
throw new Exception(G::LoadTranslation('ID_USER_NOT_EXIST_DEPARTMENT', [$userUid]));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,16 +72,15 @@ class Department
|
|||||||
* @param string $departmentTitle Title
|
* @param string $departmentTitle Title
|
||||||
* @param string $fieldNameForException Field name for the exception
|
* @param string $fieldNameForException Field name for the exception
|
||||||
* @param string $departmentUidExclude Unique id of Department to exclude
|
* @param string $departmentUidExclude Unique id of Department to exclude
|
||||||
*
|
* @return void Throw exception if exists the title of a Department
|
||||||
* return void Throw exception if exists the title of a Department
|
|
||||||
*/
|
*/
|
||||||
public function throwExceptionIfExistsTitle($departmentTitle, $fieldNameForException, $departmentUidExclude = "")
|
public function throwExceptionIfExistsTitle($departmentTitle, $fieldNameForException, $departmentUidExclude = "")
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if ($this->existsTitle($departmentTitle, $departmentUidExclude)) {
|
if ($this->existsTitle($departmentTitle, $departmentUidExclude)) {
|
||||||
throw new \Exception(\G::LoadTranslation("ID_DEPARTMENT_TITLE_ALREADY_EXISTS", array($fieldNameForException, $departmentTitle)));
|
throw new Exception(G::LoadTranslation("ID_DEPARTMENT_TITLE_ALREADY_EXISTS", array($fieldNameForException, $departmentTitle)));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,7 +92,6 @@ class Department
|
|||||||
* @param array $arrayVariableNameForException Variable name for exception
|
* @param array $arrayVariableNameForException Variable name for exception
|
||||||
* @param bool $throwException Flag to throw the exception if the main parameters are invalid or do not exist
|
* @param bool $throwException Flag to throw the exception if the main parameters are invalid or do not exist
|
||||||
* (TRUE: throw the exception; FALSE: returns FALSE)
|
* (TRUE: throw the exception; FALSE: returns FALSE)
|
||||||
*
|
|
||||||
* @return array Returns an array with Department record, ThrowTheException/FALSE otherwise
|
* @return array Returns an array with Department record, ThrowTheException/FALSE otherwise
|
||||||
*/
|
*/
|
||||||
public function getDepartmentRecordByPk(
|
public function getDepartmentRecordByPk(
|
||||||
@@ -98,11 +100,11 @@ class Department
|
|||||||
$throwException = true
|
$throwException = true
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
$obj = \DepartmentPeer::retrieveByPK($departmentUid);
|
$obj = DepartmentPeer::retrieveByPK($departmentUid);
|
||||||
|
|
||||||
if (is_null($obj)) {
|
if (is_null($obj)) {
|
||||||
if ($throwException) {
|
if ($throwException) {
|
||||||
throw new \Exception(\G::LoadTranslation(
|
throw new Exception(G::LoadTranslation(
|
||||||
'ID_DEPARTMENT_NOT_EXIST', [$arrayVariableNameForException['$departmentUid'], $departmentUid]
|
'ID_DEPARTMENT_NOT_EXIST', [$arrayVariableNameForException['$departmentUid'], $departmentUid]
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
@@ -111,8 +113,8 @@ class Department
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Return
|
//Return
|
||||||
return $obj->toArray(\BasePeer::TYPE_FIELDNAME);
|
return $obj->toArray(BasePeer::TYPE_FIELDNAME);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,14 +123,11 @@ class Department
|
|||||||
* Get list for Departments
|
* Get list for Departments
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
|
||||||
* @copyright Colosa - Bolivia
|
|
||||||
*
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getDepartments()
|
public function getDepartments()
|
||||||
{
|
{
|
||||||
$oDepartment = new \Department();
|
$oDepartment = new DepartmentModel();
|
||||||
$aDepts = $oDepartment->getDepartments('');
|
$aDepts = $oDepartment->getDepartments('');
|
||||||
foreach ($aDepts as &$depData) {
|
foreach ($aDepts as &$depData) {
|
||||||
$depData['DEP_CHILDREN'] = $this->getChildren($depData);
|
$depData['DEP_CHILDREN'] = $this->getChildren($depData);
|
||||||
@@ -142,15 +141,14 @@ class Department
|
|||||||
*
|
*
|
||||||
* @param string $departmentUid Unique id of Department
|
* @param string $departmentUid Unique id of Department
|
||||||
* @param array $arrayData Data
|
* @param array $arrayData Data
|
||||||
*
|
|
||||||
* return array Return data of the User assigned to Department
|
* return array Return data of the User assigned to Department
|
||||||
*/
|
*/
|
||||||
public function assignUser($departmentUid, array $arrayData)
|
public function assignUser($departmentUid, array $arrayData)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//Verify data
|
//Verify data
|
||||||
$process = new \ProcessMaker\BusinessModel\Process();
|
$process = new Process();
|
||||||
$validator = new \ProcessMaker\BusinessModel\Validator();
|
$validator = new Validator();
|
||||||
|
|
||||||
$validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData");
|
$validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData");
|
||||||
$validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
|
$validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
|
||||||
@@ -172,14 +170,14 @@ class Department
|
|||||||
);
|
);
|
||||||
|
|
||||||
//Verify data
|
//Verify data
|
||||||
$departmentUid = \ProcessMaker\BusinessModel\Validator::depUid($departmentUid);
|
$departmentUid = Validator::depUid($departmentUid);
|
||||||
|
|
||||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $arrayUserFieldDefinition, $arrayUserFieldNameForException, true);
|
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $arrayUserFieldDefinition, $arrayUserFieldNameForException, true);
|
||||||
|
|
||||||
$process->throwExceptionIfNotExistsUser($arrayData["USR_UID"], $arrayUserFieldNameForException["userUid"]);
|
$process->throwExceptionIfNotExistsUser($arrayData["USR_UID"], $arrayUserFieldNameForException["userUid"]);
|
||||||
|
|
||||||
//Assign User
|
//Assign User
|
||||||
$department = new \Department();
|
$department = new DepartmentModel();
|
||||||
|
|
||||||
$department->load($departmentUid);
|
$department->load($departmentUid);
|
||||||
|
|
||||||
@@ -192,7 +190,7 @@ class Department
|
|||||||
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
|
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
|
||||||
|
|
||||||
return $arrayData;
|
return $arrayData;
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -201,9 +199,6 @@ class Department
|
|||||||
* Post Unassign User
|
* Post Unassign User
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
|
||||||
* @copyright Colosa - Bolivia
|
|
||||||
*
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function unassignUser($dep_uid, $usr_uid)
|
public function unassignUser($dep_uid, $usr_uid)
|
||||||
@@ -213,7 +208,7 @@ class Department
|
|||||||
|
|
||||||
$this->throwExceptionUserNotExistsInDepartment($dep_uid, $usr_uid);
|
$this->throwExceptionUserNotExistsInDepartment($dep_uid, $usr_uid);
|
||||||
|
|
||||||
$dep = new \Department();
|
$dep = new DepartmentModel();
|
||||||
$dep->load( $dep_uid );
|
$dep->load( $dep_uid );
|
||||||
$manager = $dep->getDepManager();
|
$manager = $dep->getDepManager();
|
||||||
$dep->removeUserFromDepartment( $dep_uid, $usr_uid );
|
$dep->removeUserFromDepartment( $dep_uid, $usr_uid );
|
||||||
@@ -229,7 +224,6 @@ class Department
|
|||||||
* Get custom record
|
* Get custom record
|
||||||
*
|
*
|
||||||
* @param array $record Record
|
* @param array $record Record
|
||||||
*
|
|
||||||
* @return array Return an array with custom record
|
* @return array Return an array with custom record
|
||||||
*/
|
*/
|
||||||
private function __getUserCustomRecordFromRecord(array $record)
|
private function __getUserCustomRecordFromRecord(array $record)
|
||||||
@@ -248,7 +242,7 @@ class Department
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $recordc;
|
return $recordc;
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -266,7 +260,6 @@ class Department
|
|||||||
* @param bool $flagRecord Flag that set the "getting" of record
|
* @param bool $flagRecord Flag that set the "getting" of record
|
||||||
* @param bool $throwException Flag to throw the exception (This only if the parameters are invalid)
|
* @param bool $throwException Flag to throw the exception (This only if the parameters are invalid)
|
||||||
* (TRUE: throw the exception; FALSE: returns FALSE)
|
* (TRUE: throw the exception; FALSE: returns FALSE)
|
||||||
*
|
|
||||||
* @return array Return an array with all Users of a Department, ThrowTheException/FALSE otherwise
|
* @return array Return an array with all Users of a Department, ThrowTheException/FALSE otherwise
|
||||||
*/
|
*/
|
||||||
public function getUsers(
|
public function getUsers(
|
||||||
@@ -288,14 +281,14 @@ class Department
|
|||||||
//Verify data and Set variables
|
//Verify data and Set variables
|
||||||
$flagFilter = !is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData['filter']);
|
$flagFilter = !is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData['filter']);
|
||||||
|
|
||||||
$result = \ProcessMaker\BusinessModel\Validator::validatePagerDataByPagerDefinition(
|
$result = Validator::validatePagerDataByPagerDefinition(
|
||||||
['$start' => $start, '$limit' => $limit],
|
['$start' => $start, '$limit' => $limit],
|
||||||
['$start' => '$start', '$limit' => '$limit']
|
['$start' => '$start', '$limit' => '$limit']
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result !== true) {
|
if ($result !== true) {
|
||||||
if ($throwException) {
|
if ($throwException) {
|
||||||
throw new \Exception($result);
|
throw new Exception($result);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -336,22 +329,23 @@ class Department
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Query
|
//Query
|
||||||
$criteria = new \Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
|
|
||||||
$criteria->addSelectColumn(\UsersPeer::USR_UID);
|
$criteria->addSelectColumn(UsersPeer::USR_UID);
|
||||||
$criteria->addSelectColumn(\UsersPeer::USR_USERNAME);
|
$criteria->addSelectColumn(UsersPeer::USR_USERNAME);
|
||||||
$criteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME);
|
$criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
|
||||||
$criteria->addSelectColumn(\UsersPeer::USR_LASTNAME);
|
$criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
|
||||||
$criteria->addSelectColumn(\UsersPeer::USR_STATUS);
|
$criteria->addSelectColumn(UsersPeer::USR_STATUS);
|
||||||
|
|
||||||
$criteria->add(\UsersPeer::USR_STATUS, 'CLOSED', \Criteria::NOT_EQUAL);
|
$criteria->add(UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL);
|
||||||
|
|
||||||
switch ($option) {
|
switch ($option) {
|
||||||
case 'ASSIGNED':
|
case 'ASSIGNED':
|
||||||
$criteria->add(\UsersPeer::DEP_UID, $departmentUid, \Criteria::EQUAL);
|
$criteria->add(UsersPeer::DEP_UID, $departmentUid, Criteria::EQUAL);
|
||||||
break;
|
break;
|
||||||
case 'AVAILABLE':
|
case 'AVAILABLE':
|
||||||
$criteria->add(\UsersPeer::DEP_UID, '', \Criteria::EQUAL);
|
$criteria->add(UsersPeer::DEP_UID, '', Criteria::EQUAL);
|
||||||
|
$criteria->add(UsersPeer::USR_UID, RBAC::GUEST_USER_UID, Criteria::NOT_EQUAL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,24 +361,24 @@ class Department
|
|||||||
];
|
];
|
||||||
|
|
||||||
$criteria->add(
|
$criteria->add(
|
||||||
$criteria->getNewCriterion(\UsersPeer::USR_USERNAME, $search, \Criteria::LIKE)->addOr(
|
$criteria->getNewCriterion(UsersPeer::USR_USERNAME, $search, Criteria::LIKE)->addOr(
|
||||||
$criteria->getNewCriterion(\UsersPeer::USR_FIRSTNAME, $search, \Criteria::LIKE)->addOr(
|
$criteria->getNewCriterion(UsersPeer::USR_FIRSTNAME, $search, Criteria::LIKE)->addOr(
|
||||||
$criteria->getNewCriterion(\UsersPeer::USR_LASTNAME, $search, \Criteria::LIKE)))
|
$criteria->getNewCriterion(UsersPeer::USR_LASTNAME, $search, Criteria::LIKE)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Number records total
|
//Number records total
|
||||||
$numRecTotal = \UsersPeer::doCount($criteria);
|
$numRecTotal = UsersPeer::doCount($criteria);
|
||||||
|
|
||||||
//Query
|
//Query
|
||||||
$conf = new \Configurations();
|
$conf = new Configurations();
|
||||||
$sortFieldDefault = \UsersPeer::TABLE_NAME . '.' . $conf->userNameFormatGetFirstFieldByUsersTable();
|
$sortFieldDefault = UsersPeer::TABLE_NAME . '.' . $conf->userNameFormatGetFirstFieldByUsersTable();
|
||||||
|
|
||||||
if (!is_null($sortField) && trim($sortField) != '') {
|
if (!is_null($sortField) && trim($sortField) != '') {
|
||||||
$sortField = strtoupper($sortField);
|
$sortField = strtoupper($sortField);
|
||||||
|
|
||||||
if (in_array(\UsersPeer::TABLE_NAME . '.' . $sortField, $criteria->getSelectColumns())) {
|
if (in_array(UsersPeer::TABLE_NAME . '.' . $sortField, $criteria->getSelectColumns())) {
|
||||||
$sortField = \UsersPeer::TABLE_NAME . '.' . $sortField;
|
$sortField = UsersPeer::TABLE_NAME . '.' . $sortField;
|
||||||
} else {
|
} else {
|
||||||
$sortField = $sortFieldDefault;
|
$sortField = $sortFieldDefault;
|
||||||
}
|
}
|
||||||
@@ -406,8 +400,8 @@ class Department
|
|||||||
$criteria->setLimit((int)($limit));
|
$criteria->setLimit((int)($limit));
|
||||||
}
|
}
|
||||||
|
|
||||||
$rsCriteria = \UsersPeer::doSelectRS($criteria);
|
$rsCriteria = UsersPeer::doSelectRS($criteria);
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
while ($rsCriteria->next()) {
|
while ($rsCriteria->next()) {
|
||||||
$record = $rsCriteria->getRow();
|
$record = $rsCriteria->getRow();
|
||||||
@@ -431,7 +425,7 @@ class Department
|
|||||||
$filterName => ($flagFilter)? $arrayFilterData['filter'] : '',
|
$filterName => ($flagFilter)? $arrayFilterData['filter'] : '',
|
||||||
'data' => $arrayUser
|
'data' => $arrayUser
|
||||||
];
|
];
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -440,9 +434,6 @@ class Department
|
|||||||
* Put Set Manager User
|
* Put Set Manager User
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
|
||||||
* @copyright Colosa - Bolivia
|
|
||||||
*
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setManagerUser($dep_uid, $usr_uid)
|
public function setManagerUser($dep_uid, $usr_uid)
|
||||||
@@ -450,23 +441,23 @@ class Department
|
|||||||
$dep_uid = Validator::depUid($dep_uid);
|
$dep_uid = Validator::depUid($dep_uid);
|
||||||
$usr_uid = Validator::usrUid($usr_uid);
|
$usr_uid = Validator::usrUid($usr_uid);
|
||||||
|
|
||||||
$oCriteria = new \Criteria( 'workflow' );
|
$oCriteria = new Criteria( 'workflow' );
|
||||||
$oCriteria->addSelectColumn( DepartmentPeer::DEP_UID );
|
$oCriteria->addSelectColumn( DepartmentPeer::DEP_UID );
|
||||||
$oCriteria->add( DepartmentPeer::DEP_MANAGER, $usr_uid, \Criteria::EQUAL );
|
$oCriteria->add( DepartmentPeer::DEP_MANAGER, $usr_uid, Criteria::EQUAL );
|
||||||
|
|
||||||
$oDataset = DepartmentPeer::doSelectRS( $oCriteria );
|
$oDataset = DepartmentPeer::doSelectRS( $oCriteria );
|
||||||
$oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
if ($oDataset->next()) {
|
if ($oDataset->next()) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_DEPARTMENT_MANAGER_EXIST", array('usr_uid',$usr_uid))));
|
throw (new Exception(G::LoadTranslation("ID_DEPARTMENT_MANAGER_EXIST", array('usr_uid',$usr_uid))));
|
||||||
}
|
}
|
||||||
|
|
||||||
$editDepartment['DEP_UID'] = $dep_uid;
|
$editDepartment['DEP_UID'] = $dep_uid;
|
||||||
$editDepartment['DEP_MANAGER'] = $usr_uid;
|
$editDepartment['DEP_MANAGER'] = $usr_uid;
|
||||||
$oDept = new \Department();
|
$oDept = new DepartmentModel();
|
||||||
$oDept->update( $editDepartment );
|
$oDept->update( $editDepartment );
|
||||||
$oDept->updateDepartmentManager( $dep_uid );
|
$oDept->updateDepartmentManager( $dep_uid );
|
||||||
|
|
||||||
$oDept = new \Department();
|
$oDept = new DepartmentModel();
|
||||||
$oDept->Load($dep_uid);
|
$oDept->Load($dep_uid);
|
||||||
$oDept->addUserToDepartment($dep_uid, $usr_uid, ($oDept->getDepManager() == "")? true : false, false);
|
$oDept->addUserToDepartment($dep_uid, $usr_uid, ($oDept->getDepManager() == "")? true : false, false);
|
||||||
$oDept->updateDepartmentManager($dep_uid);
|
$oDept->updateDepartmentManager($dep_uid);
|
||||||
@@ -474,22 +465,19 @@ class Department
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get list for Departments
|
* Get list for Departments
|
||||||
|
*
|
||||||
* @var string $dep_uid. Uid for Department
|
* @var string $dep_uid. Uid for Department
|
||||||
*
|
|
||||||
* @access public
|
* @access public
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
|
||||||
* @copyright Colosa - Bolivia
|
|
||||||
*
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getDepartment($dep_uid)
|
public function getDepartment($dep_uid)
|
||||||
{
|
{
|
||||||
$dep_uid = Validator::depUid($dep_uid);
|
$dep_uid = Validator::depUid($dep_uid);
|
||||||
$criteria = new \Criteria( 'workflow' );
|
$criteria = new Criteria( 'workflow' );
|
||||||
$criteria->add( DepartmentPeer::DEP_UID, $dep_uid, \Criteria::EQUAL );
|
$criteria->add( DepartmentPeer::DEP_UID, $dep_uid, Criteria::EQUAL );
|
||||||
$con = \Propel::getConnection( DepartmentPeer::DATABASE_NAME );
|
$con = Propel::getConnection( DepartmentPeer::DATABASE_NAME );
|
||||||
$objects = DepartmentPeer::doSelect( $criteria, $con );
|
$objects = DepartmentPeer::doSelect( $criteria, $con );
|
||||||
$oUsers = new \Users();
|
$oUsers = new Users();
|
||||||
|
|
||||||
$node = array ();
|
$node = array ();
|
||||||
foreach ($objects as $oDepartment) {
|
foreach ($objects as $oDepartment) {
|
||||||
@@ -513,14 +501,14 @@ class Department
|
|||||||
$node['DEP_MANAGER_LASTNAME'] = '';
|
$node['DEP_MANAGER_LASTNAME'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$criteria = new \Criteria();
|
$criteria = new Criteria();
|
||||||
$criteria->add(UsersPeer::DEP_UID, $dep_uid, \Criteria::EQUAL );
|
$criteria->add(UsersPeer::DEP_UID, $dep_uid, Criteria::EQUAL );
|
||||||
$node['DEP_MEMBERS'] = UsersPeer::doCount($criteria);
|
$node['DEP_MEMBERS'] = UsersPeer::doCount($criteria);
|
||||||
|
|
||||||
$criteriaCount = new \Criteria( 'workflow' );
|
$criteriaCount = new Criteria( 'workflow' );
|
||||||
$criteriaCount->clearSelectColumns();
|
$criteriaCount->clearSelectColumns();
|
||||||
$criteriaCount->addSelectColumn( 'COUNT(*)' );
|
$criteriaCount->addSelectColumn( 'COUNT(*)' );
|
||||||
$criteriaCount->add( DepartmentPeer::DEP_PARENT, $oDepartment->getDepUid(), \Criteria::EQUAL );
|
$criteriaCount->add( DepartmentPeer::DEP_PARENT, $oDepartment->getDepUid(), Criteria::EQUAL );
|
||||||
$rs = DepartmentPeer::doSelectRS( $criteriaCount );
|
$rs = DepartmentPeer::doSelectRS( $criteriaCount );
|
||||||
$rs->next();
|
$rs->next();
|
||||||
$row = $rs->getRow();
|
$row = $rs->getRow();
|
||||||
@@ -532,13 +520,10 @@ class Department
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Save Department
|
* Save Department
|
||||||
|
*
|
||||||
* @var string $dep_data. Data for Process
|
* @var string $dep_data. Data for Process
|
||||||
* @var string $create. Flag for create or update
|
* @var string $create. Flag for create or update
|
||||||
*
|
|
||||||
* @access public
|
* @access public
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
|
||||||
* @copyright Colosa - Bolivia
|
|
||||||
*
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function saveDepartment($dep_data, $create = true)
|
public function saveDepartment($dep_data, $create = true)
|
||||||
@@ -553,7 +538,7 @@ class Department
|
|||||||
unset($dep_data["DEP_UID"]);
|
unset($dep_data["DEP_UID"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$oDepartment = new \Department();
|
$oDepartment = new DepartmentModel();
|
||||||
if (isset($dep_data['DEP_UID']) && $dep_data['DEP_UID'] != '') {
|
if (isset($dep_data['DEP_UID']) && $dep_data['DEP_UID'] != '') {
|
||||||
Validator::depUid($dep_data['DEP_UID']);
|
Validator::depUid($dep_data['DEP_UID']);
|
||||||
}
|
}
|
||||||
@@ -580,7 +565,7 @@ class Department
|
|||||||
if (isset($dep_data['DEP_TITLE'])) {
|
if (isset($dep_data['DEP_TITLE'])) {
|
||||||
$this->throwExceptionIfExistsTitle($dep_data["DEP_TITLE"], strtolower("DEP_TITLE"));
|
$this->throwExceptionIfExistsTitle($dep_data["DEP_TITLE"], strtolower("DEP_TITLE"));
|
||||||
} else {
|
} else {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_FIELD_REQUIRED", array('dep_title'))));
|
throw (new Exception(G::LoadTranslation("ID_FIELD_REQUIRED", array('dep_title'))));
|
||||||
}
|
}
|
||||||
|
|
||||||
$dep_uid = $oDepartment->create($dep_data);
|
$dep_uid = $oDepartment->create($dep_data);
|
||||||
@@ -594,41 +579,35 @@ class Department
|
|||||||
* @var string $dep_uid. Uid for department
|
* @var string $dep_uid. Uid for department
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
|
||||||
* @copyright Colosa - Bolivia
|
|
||||||
*
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function deleteDepartment($dep_uid)
|
public function deleteDepartment($dep_uid)
|
||||||
{
|
{
|
||||||
$dep_uid = Validator::depUid($dep_uid);
|
$dep_uid = Validator::depUid($dep_uid);
|
||||||
$oDepartment = new \Department();
|
$oDepartment = new DepartmentModel();
|
||||||
$countUsers = $oDepartment->cantUsersInDepartment($dep_uid);
|
$countUsers = $oDepartment->cantUsersInDepartment($dep_uid);
|
||||||
if ($countUsers != 0) {
|
if ($countUsers != 0) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_CANT_DELETE_DEPARTMENT_HAS_USERS")));
|
throw (new Exception(G::LoadTranslation("ID_CANT_DELETE_DEPARTMENT_HAS_USERS")));
|
||||||
}
|
}
|
||||||
$dep_data = $this->getDepartment($dep_uid);
|
$dep_data = $this->getDepartment($dep_uid);
|
||||||
if ($dep_data['has_children'] != 0) {
|
if ($dep_data['has_children'] != 0) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_CANT_DELETE_DEPARTMENT_HAS_CHILDREN")));
|
throw (new Exception(G::LoadTranslation("ID_CANT_DELETE_DEPARTMENT_HAS_CHILDREN")));
|
||||||
}
|
}
|
||||||
$oDepartment->remove($dep_uid);
|
$oDepartment->remove($dep_uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Look for Children for department
|
* Look for Children for department
|
||||||
|
*
|
||||||
* @var array $dataDep. Data for child department
|
* @var array $dataDep. Data for child department
|
||||||
*
|
|
||||||
* @access public
|
* @access public
|
||||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
|
||||||
* @copyright Colosa - Bolivia
|
|
||||||
*
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getChildren ($dataDep)
|
protected function getChildren ($dataDep)
|
||||||
{
|
{
|
||||||
$children = array();
|
$children = array();
|
||||||
if ((int)$dataDep['HAS_CHILDREN'] > 0) {
|
if ((int)$dataDep['HAS_CHILDREN'] > 0) {
|
||||||
$oDepartment = new \Department();
|
$oDepartment = new DepartmentModel();
|
||||||
$aDepts = $oDepartment->getDepartments($dataDep['DEP_UID']);
|
$aDepts = $oDepartment->getDepartments($dataDep['DEP_UID']);
|
||||||
foreach ($aDepts as &$depData) {
|
foreach ($aDepts as &$depData) {
|
||||||
$depData['DEP_CHILDREN'] = $this->getChildren($depData);
|
$depData['DEP_CHILDREN'] = $this->getChildren($depData);
|
||||||
@@ -639,4 +618,3 @@ class Department
|
|||||||
return $children;
|
return $children;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace ProcessMaker\BusinessModel\Role;
|
namespace ProcessMaker\BusinessModel\Role;
|
||||||
|
|
||||||
|
use Configurations;
|
||||||
|
use Criteria;
|
||||||
|
use Exception;
|
||||||
|
use G;
|
||||||
|
use ProcessMaker\BusinessModel\Process;
|
||||||
|
use ProcessMaker\BusinessModel\Role;
|
||||||
|
use ProcessMaker\BusinessModel\Validator;
|
||||||
|
use RBAC;
|
||||||
|
use RbacUsersPeer;
|
||||||
|
use ResultSet;
|
||||||
|
use Roles;
|
||||||
|
use UsersRolesPeer;
|
||||||
|
|
||||||
class User
|
class User
|
||||||
{
|
{
|
||||||
private $arrayFieldDefinition = array(
|
private $arrayFieldDefinition = array(
|
||||||
@@ -19,7 +32,7 @@ class User
|
|||||||
/**
|
/**
|
||||||
* Constructor of the class
|
* Constructor of the class
|
||||||
*
|
*
|
||||||
* return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -27,7 +40,7 @@ class User
|
|||||||
foreach ($this->arrayFieldDefinition as $key => $value) {
|
foreach ($this->arrayFieldDefinition as $key => $value) {
|
||||||
$this->arrayFieldNameForException[$value["fieldNameAux"]] = $key;
|
$this->arrayFieldNameForException[$value["fieldNameAux"]] = $key;
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,8 +49,7 @@ class User
|
|||||||
* Set the format of the fields name (uppercase, lowercase)
|
* Set the format of the fields name (uppercase, lowercase)
|
||||||
*
|
*
|
||||||
* @param bool $flag Value that set the format
|
* @param bool $flag Value that set the format
|
||||||
*
|
* @return void
|
||||||
* return void
|
|
||||||
*/
|
*/
|
||||||
public function setFormatFieldNameInUppercase($flag)
|
public function setFormatFieldNameInUppercase($flag)
|
||||||
{
|
{
|
||||||
@@ -45,7 +57,7 @@ class User
|
|||||||
$this->formatFieldNameInUppercase = $flag;
|
$this->formatFieldNameInUppercase = $flag;
|
||||||
|
|
||||||
$this->setArrayFieldNameForException($this->arrayFieldNameForException);
|
$this->setArrayFieldNameForException($this->arrayFieldNameForException);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,8 +66,7 @@ class User
|
|||||||
* Set exception messages for fields
|
* Set exception messages for fields
|
||||||
*
|
*
|
||||||
* @param array $arrayData Data with the fields
|
* @param array $arrayData Data with the fields
|
||||||
*
|
* @return void
|
||||||
* return void
|
|
||||||
*/
|
*/
|
||||||
public function setArrayFieldNameForException(array $arrayData)
|
public function setArrayFieldNameForException(array $arrayData)
|
||||||
{
|
{
|
||||||
@@ -63,7 +74,7 @@ class User
|
|||||||
foreach ($arrayData as $key => $value) {
|
foreach ($arrayData as $key => $value) {
|
||||||
$this->arrayFieldNameForException[$key] = $this->getFieldNameByFormatFieldName($value);
|
$this->arrayFieldNameForException[$key] = $this->getFieldNameByFormatFieldName($value);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,14 +83,13 @@ class User
|
|||||||
* Get the name of the field according to the format
|
* Get the name of the field according to the format
|
||||||
*
|
*
|
||||||
* @param string $fieldName Field name
|
* @param string $fieldName Field name
|
||||||
*
|
* @return string Return the field name according the format
|
||||||
* return string Return the field name according the format
|
|
||||||
*/
|
*/
|
||||||
public function getFieldNameByFormatFieldName($fieldName)
|
public function getFieldNameByFormatFieldName($fieldName)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return ($this->formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName);
|
return ($this->formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,18 +100,17 @@ class User
|
|||||||
* @param string $roleUid Unique id of Role
|
* @param string $roleUid Unique id of Role
|
||||||
* @param string $userUid Unique id of User
|
* @param string $userUid Unique id of User
|
||||||
* @param string $fieldNameForException Field name for the exception
|
* @param string $fieldNameForException Field name for the exception
|
||||||
*
|
* @return void Throw exception if it's assigned the User to Role
|
||||||
* return void Throw exception if it's assigned the User to Role
|
|
||||||
*/
|
*/
|
||||||
public function throwExceptionIfItsAssignedUserToRole($roleUid, $userUid, $fieldNameForException)
|
public function throwExceptionIfItsAssignedUserToRole($roleUid, $userUid, $fieldNameForException)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$obj = \UsersRolesPeer::retrieveByPK($userUid, $roleUid);
|
$obj = UsersRolesPeer::retrieveByPK($userUid, $roleUid);
|
||||||
|
|
||||||
if (!is_null($obj)) {
|
if (!is_null($obj)) {
|
||||||
throw new \Exception(\G::LoadTranslation("ID_ROLE_USER_IS_ALREADY_ASSIGNED", array($fieldNameForException, $userUid)));
|
throw new Exception(G::LoadTranslation("ID_ROLE_USER_IS_ALREADY_ASSIGNED", array($fieldNameForException, $userUid)));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,18 +121,17 @@ class User
|
|||||||
* @param string $roleUid Unique id of Role
|
* @param string $roleUid Unique id of Role
|
||||||
* @param string $userUid Unique id of User
|
* @param string $userUid Unique id of User
|
||||||
* @param string $fieldNameForException Field name for the exception
|
* @param string $fieldNameForException Field name for the exception
|
||||||
*
|
* @return void Throw exception if not it's assigned the User to Role
|
||||||
* return void Throw exception if not it's assigned the User to Role
|
|
||||||
*/
|
*/
|
||||||
public function throwExceptionIfNotItsAssignedUserToRole($roleUid, $userUid, $fieldNameForException)
|
public function throwExceptionIfNotItsAssignedUserToRole($roleUid, $userUid, $fieldNameForException)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$obj = \UsersRolesPeer::retrieveByPK($userUid, $roleUid);
|
$obj = UsersRolesPeer::retrieveByPK($userUid, $roleUid);
|
||||||
|
|
||||||
if (is_null($obj)) {
|
if (is_null($obj)) {
|
||||||
throw new \Exception(\G::LoadTranslation("ID_ROLE_USER_IS_NOT_ASSIGNED", array($fieldNameForException, $userUid)));
|
throw new Exception(G::LoadTranslation("ID_ROLE_USER_IS_NOT_ASSIGNED", array($fieldNameForException, $userUid)));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,15 +141,14 @@ class User
|
|||||||
*
|
*
|
||||||
* @param string $roleUid Unique id of Role
|
* @param string $roleUid Unique id of Role
|
||||||
* @param array $arrayData Data
|
* @param array $arrayData Data
|
||||||
*
|
* @return array Return data of the User assigned to Role
|
||||||
* return array Return data of the User assigned to Role
|
|
||||||
*/
|
*/
|
||||||
public function create($roleUid, array $arrayData)
|
public function create($roleUid, array $arrayData)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//Verify data
|
//Verify data
|
||||||
$process = new \ProcessMaker\BusinessModel\Process();
|
$process = new Process();
|
||||||
$validator = new \ProcessMaker\BusinessModel\Validator();
|
$validator = new Validator();
|
||||||
|
|
||||||
$validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
|
$validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
|
||||||
|
|
||||||
@@ -151,7 +158,7 @@ class User
|
|||||||
unset($arrayData["ROL_UID"]);
|
unset($arrayData["ROL_UID"]);
|
||||||
|
|
||||||
//Verify data
|
//Verify data
|
||||||
$role = new \ProcessMaker\BusinessModel\Role();
|
$role = new Role();
|
||||||
|
|
||||||
$role->throwExceptionIfNotExistsRole($roleUid, $this->arrayFieldNameForException["roleUid"]);
|
$role->throwExceptionIfNotExistsRole($roleUid, $this->arrayFieldNameForException["roleUid"]);
|
||||||
|
|
||||||
@@ -162,11 +169,11 @@ class User
|
|||||||
$this->throwExceptionIfItsAssignedUserToRole($roleUid, $arrayData["USR_UID"], $this->arrayFieldNameForException["userUid"]);
|
$this->throwExceptionIfItsAssignedUserToRole($roleUid, $arrayData["USR_UID"], $this->arrayFieldNameForException["userUid"]);
|
||||||
|
|
||||||
if ($arrayData["USR_UID"] == "00000000000000000000000000000001") {
|
if ($arrayData["USR_UID"] == "00000000000000000000000000000001") {
|
||||||
throw new \Exception(\G::LoadTranslation("ID_ADMINISTRATOR_ROLE_CANT_CHANGED"));
|
throw new Exception(G::LoadTranslation("ID_ADMINISTRATOR_ROLE_CANT_CHANGED"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create
|
//Create
|
||||||
$role = new \Roles();
|
$role = new Roles();
|
||||||
|
|
||||||
$arrayData = array_merge(array("ROL_UID" => $roleUid), $arrayData);
|
$arrayData = array_merge(array("ROL_UID" => $roleUid), $arrayData);
|
||||||
|
|
||||||
@@ -178,7 +185,7 @@ class User
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $arrayData;
|
return $arrayData;
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -188,15 +195,14 @@ class User
|
|||||||
*
|
*
|
||||||
* @param string $roleUid Unique id of Role
|
* @param string $roleUid Unique id of Role
|
||||||
* @param string $userUid Unique id of User
|
* @param string $userUid Unique id of User
|
||||||
*
|
* @return void
|
||||||
* return void
|
|
||||||
*/
|
*/
|
||||||
public function delete($roleUid, $userUid)
|
public function delete($roleUid, $userUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//Verify data
|
//Verify data
|
||||||
$process = new \ProcessMaker\BusinessModel\Process();
|
$process = new Process();
|
||||||
$role = new \ProcessMaker\BusinessModel\Role();
|
$role = new Role();
|
||||||
|
|
||||||
$role->throwExceptionIfNotExistsRole($roleUid, $this->arrayFieldNameForException["roleUid"]);
|
$role->throwExceptionIfNotExistsRole($roleUid, $this->arrayFieldNameForException["roleUid"]);
|
||||||
|
|
||||||
@@ -205,14 +211,14 @@ class User
|
|||||||
$this->throwExceptionIfNotItsAssignedUserToRole($roleUid, $userUid, $this->arrayFieldNameForException["userUid"]);
|
$this->throwExceptionIfNotItsAssignedUserToRole($roleUid, $userUid, $this->arrayFieldNameForException["userUid"]);
|
||||||
|
|
||||||
if ($userUid == "00000000000000000000000000000001") {
|
if ($userUid == "00000000000000000000000000000001") {
|
||||||
throw new \Exception(\G::LoadTranslation("ID_ADMINISTRATOR_ROLE_CANT_CHANGED"));
|
throw new Exception(G::LoadTranslation("ID_ADMINISTRATOR_ROLE_CANT_CHANGED"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Delete
|
//Delete
|
||||||
$role = new \Roles();
|
$role = new Roles();
|
||||||
|
|
||||||
$role->deleteUserRole($roleUid, $userUid);
|
$role->deleteUserRole($roleUid, $userUid);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -221,8 +227,7 @@ class User
|
|||||||
* Get data of a User from a record
|
* Get data of a User from a record
|
||||||
*
|
*
|
||||||
* @param array $record Record
|
* @param array $record Record
|
||||||
*
|
* @return array Return an array with data User
|
||||||
* return array Return an array with data User
|
|
||||||
*/
|
*/
|
||||||
public function getUserDataFromRecord(array $record)
|
public function getUserDataFromRecord(array $record)
|
||||||
{
|
{
|
||||||
@@ -234,7 +239,7 @@ class User
|
|||||||
$this->getFieldNameByFormatFieldName("USR_LASTNAME") => $record["USR_LASTNAME"] . "",
|
$this->getFieldNameByFormatFieldName("USR_LASTNAME") => $record["USR_LASTNAME"] . "",
|
||||||
$this->getFieldNameByFormatFieldName("USR_STATUS") => ($record["USR_STATUS"] . "" == "1")? "ACTIVE" : "INACTIVE"
|
$this->getFieldNameByFormatFieldName("USR_STATUS") => ($record["USR_STATUS"] . "" == "1")? "ACTIVE" : "INACTIVE"
|
||||||
);
|
);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -249,8 +254,7 @@ class User
|
|||||||
* @param string $sortDir Direction of sorting (ASC, DESC)
|
* @param string $sortDir Direction of sorting (ASC, DESC)
|
||||||
* @param int $start Start
|
* @param int $start Start
|
||||||
* @param int $limit Limit
|
* @param int $limit Limit
|
||||||
*
|
* @return array Return an array with all Users of a Role
|
||||||
* return array Return an array with all Users of a Role
|
|
||||||
*/
|
*/
|
||||||
public function getUsers($roleUid, $option, array $arrayFilterData = null, $sortField = null, $sortDir = null, $start = null, $limit = null)
|
public function getUsers($roleUid, $option, array $arrayFilterData = null, $sortField = null, $sortDir = null, $start = null, $limit = null)
|
||||||
{
|
{
|
||||||
@@ -262,8 +266,8 @@ class User
|
|||||||
//Verify data and Set variables
|
//Verify data and Set variables
|
||||||
$flagFilter = !is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData['filter']);
|
$flagFilter = !is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData['filter']);
|
||||||
|
|
||||||
$process = new \ProcessMaker\BusinessModel\Process();
|
$process = new Process();
|
||||||
$role = new \ProcessMaker\BusinessModel\Role();
|
$role = new Role();
|
||||||
|
|
||||||
$role->throwExceptionIfNotExistsRole($roleUid, $this->arrayFieldNameForException["roleUid"]);
|
$role->throwExceptionIfNotExistsRole($roleUid, $this->arrayFieldNameForException["roleUid"]);
|
||||||
|
|
||||||
@@ -303,24 +307,25 @@ class User
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Query
|
//Query
|
||||||
$criteria = new \Criteria('rbac');
|
$criteria = new Criteria('rbac');
|
||||||
|
|
||||||
$criteria->addSelectColumn(\RbacUsersPeer::USR_UID);
|
$criteria->addSelectColumn(RbacUsersPeer::USR_UID);
|
||||||
$criteria->addSelectColumn(\RbacUsersPeer::USR_USERNAME);
|
$criteria->addSelectColumn(RbacUsersPeer::USR_USERNAME);
|
||||||
$criteria->addSelectColumn(\RbacUsersPeer::USR_FIRSTNAME);
|
$criteria->addSelectColumn(RbacUsersPeer::USR_FIRSTNAME);
|
||||||
$criteria->addSelectColumn(\RbacUsersPeer::USR_LASTNAME);
|
$criteria->addSelectColumn(RbacUsersPeer::USR_LASTNAME);
|
||||||
$criteria->addSelectColumn(\RbacUsersPeer::USR_STATUS);
|
$criteria->addSelectColumn(RbacUsersPeer::USR_STATUS);
|
||||||
|
|
||||||
$criteria->addJoin(\RbacUsersPeer::USR_UID, \UsersRolesPeer::USR_UID, \Criteria::LEFT_JOIN);
|
$criteria->addJoin(RbacUsersPeer::USR_UID, UsersRolesPeer::USR_UID, Criteria::LEFT_JOIN);
|
||||||
|
|
||||||
$criteria->add(\RbacUsersPeer::USR_USERNAME, '', \Criteria::NOT_EQUAL);
|
$criteria->add(RbacUsersPeer::USR_USERNAME, '', Criteria::NOT_EQUAL);
|
||||||
|
|
||||||
switch ($option) {
|
switch ($option) {
|
||||||
case "USERS":
|
case "USERS":
|
||||||
$criteria->add(\UsersRolesPeer::ROL_UID, $roleUid, \Criteria::EQUAL);
|
$criteria->add(UsersRolesPeer::ROL_UID, $roleUid, Criteria::EQUAL);
|
||||||
break;
|
break;
|
||||||
case "AVAILABLE-USERS":
|
case "AVAILABLE-USERS":
|
||||||
$criteria->add(\UsersRolesPeer::ROL_UID, $roleUid, \Criteria::NOT_EQUAL);
|
$criteria->add(UsersRolesPeer::ROL_UID, $roleUid, Criteria::NOT_EQUAL);
|
||||||
|
$criteria->add(RbacUsersPeer::USR_UID, [RBAC::GUEST_USER_UID], Criteria::NOT_IN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,24 +341,24 @@ class User
|
|||||||
];
|
];
|
||||||
|
|
||||||
$criteria->add(
|
$criteria->add(
|
||||||
$criteria->getNewCriterion(\RbacUsersPeer::USR_USERNAME, $search, \Criteria::LIKE)->addOr(
|
$criteria->getNewCriterion(RbacUsersPeer::USR_USERNAME, $search, Criteria::LIKE)->addOr(
|
||||||
$criteria->getNewCriterion(\RbacUsersPeer::USR_FIRSTNAME, $search, \Criteria::LIKE)->addOr(
|
$criteria->getNewCriterion(RbacUsersPeer::USR_FIRSTNAME, $search, Criteria::LIKE)->addOr(
|
||||||
$criteria->getNewCriterion(\RbacUsersPeer::USR_LASTNAME, $search, \Criteria::LIKE)))
|
$criteria->getNewCriterion(RbacUsersPeer::USR_LASTNAME, $search, Criteria::LIKE)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Number records total
|
//Number records total
|
||||||
$numRecTotal = \RbacUsersPeer::doCount($criteria);
|
$numRecTotal = RbacUsersPeer::doCount($criteria);
|
||||||
|
|
||||||
//Query
|
//Query
|
||||||
$conf = new \Configurations();
|
$conf = new Configurations();
|
||||||
$sortFieldDefault = \RbacUsersPeer::TABLE_NAME . '.' . $conf->userNameFormatGetFirstFieldByUsersTable();
|
$sortFieldDefault = RbacUsersPeer::TABLE_NAME . '.' . $conf->userNameFormatGetFirstFieldByUsersTable();
|
||||||
|
|
||||||
if (!is_null($sortField) && trim($sortField) != '') {
|
if (!is_null($sortField) && trim($sortField) != '') {
|
||||||
$sortField = strtoupper($sortField);
|
$sortField = strtoupper($sortField);
|
||||||
|
|
||||||
if (in_array(\RbacUsersPeer::TABLE_NAME . '.' . $sortField, $criteria->getSelectColumns())) {
|
if (in_array(RbacUsersPeer::TABLE_NAME . '.' . $sortField, $criteria->getSelectColumns())) {
|
||||||
$sortField = \RbacUsersPeer::TABLE_NAME . '.' . $sortField;
|
$sortField = RbacUsersPeer::TABLE_NAME . '.' . $sortField;
|
||||||
} else {
|
} else {
|
||||||
$sortField = $sortFieldDefault;
|
$sortField = $sortFieldDefault;
|
||||||
}
|
}
|
||||||
@@ -375,8 +380,8 @@ class User
|
|||||||
$criteria->setLimit((int)($limit));
|
$criteria->setLimit((int)($limit));
|
||||||
}
|
}
|
||||||
|
|
||||||
$rsCriteria = \RbacUsersPeer::doSelectRS($criteria);
|
$rsCriteria = RbacUsersPeer::doSelectRS($criteria);
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
while ($rsCriteria->next()) {
|
while ($rsCriteria->next()) {
|
||||||
$row = $rsCriteria->getRow();
|
$row = $rsCriteria->getRow();
|
||||||
@@ -392,7 +397,7 @@ class User
|
|||||||
$filterName => ($flagFilter)? $arrayFilterData['filter'] : '',
|
$filterName => ($flagFilter)? $arrayFilterData['filter'] : '',
|
||||||
'data' => $arrayUser
|
'data' => $arrayUser
|
||||||
];
|
];
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,6 +110,8 @@ class User
|
|||||||
'PREF_DEFAULT_CASES_MENUSELECTED' => 'PM_EDIT_USER_PROFILE_DEFAULT_CASES_MENU_OPTIONS'
|
'PREF_DEFAULT_CASES_MENUSELECTED' => 'PM_EDIT_USER_PROFILE_DEFAULT_CASES_MENU_OPTIONS'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
private $guestUser = RBAC::GUEST_USER_UID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor of the class
|
* Constructor of the class
|
||||||
*/
|
*/
|
||||||
@@ -124,6 +126,16 @@ class User
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function get the guest user defined
|
||||||
|
*
|
||||||
|
* @return string guestUser, uid related to this user
|
||||||
|
*/
|
||||||
|
public function getGuestUser()
|
||||||
|
{
|
||||||
|
return $this->guestUser;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@@ -640,6 +652,10 @@ class User
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
//check user guest
|
||||||
|
if (RBAC::isGuestUserUid($userUid)) {
|
||||||
|
throw new Exception(G::LoadTranslation("ID_USER_CAN_NOT_UPDATE", array($userUid)));
|
||||||
|
}
|
||||||
|
|
||||||
//Verify data
|
//Verify data
|
||||||
$validator = new Validator();
|
$validator = new Validator();
|
||||||
@@ -1078,6 +1094,12 @@ class User
|
|||||||
$history += ApplicationPeer::doCount($c);
|
$history += ApplicationPeer::doCount($c);
|
||||||
$c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $USR_UID);
|
$c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $USR_UID);
|
||||||
$history += ApplicationPeer::doCount($c);
|
$history += ApplicationPeer::doCount($c);
|
||||||
|
|
||||||
|
//check user guest
|
||||||
|
if (RBAC::isGuestUserUid($usrUid)) {
|
||||||
|
throw new Exception(G::LoadTranslation("ID_MSG_CANNOT_DELETE_USER", array($USR_UID)));
|
||||||
|
}
|
||||||
|
|
||||||
if ($total > 0) {
|
if ($total > 0) {
|
||||||
throw new Exception(G::LoadTranslation("ID_USER_CAN_NOT_BE_DELETED", array($USR_UID)));
|
throw new Exception(G::LoadTranslation("ID_USER_CAN_NOT_BE_DELETED", array($USR_UID)));
|
||||||
} else {
|
} else {
|
||||||
@@ -1182,6 +1204,9 @@ class User
|
|||||||
//Query
|
//Query
|
||||||
$criteria = $this->getUserCriteria();
|
$criteria = $this->getUserCriteria();
|
||||||
|
|
||||||
|
//Remove the guest user
|
||||||
|
$criteria->add(UsersPeer::USR_UID, RBAC::GUEST_USER_UID, Criteria::NOT_EQUAL);
|
||||||
|
|
||||||
if ($flagCondition && !empty($arrayWhere['condition'])) {
|
if ($flagCondition && !empty($arrayWhere['condition'])) {
|
||||||
foreach ($arrayWhere['condition'] as $value) {
|
foreach ($arrayWhere['condition'] as $value) {
|
||||||
$criteria->add($value[0], $value[1], $value[2]);
|
$criteria->add($value[0], $value[1], $value[2]);
|
||||||
@@ -1556,6 +1581,9 @@ class User
|
|||||||
}
|
}
|
||||||
$oCriteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN);
|
$oCriteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN);
|
||||||
|
|
||||||
|
//Remove the guest user
|
||||||
|
$oCriteria->add(UsersPeer::USR_UID, RBAC::GUEST_USER_UID, Criteria::NOT_EQUAL);
|
||||||
|
|
||||||
if ($authSource != '') {
|
if ($authSource != '') {
|
||||||
$totalRows = sizeof($aUsers);
|
$totalRows = sizeof($aUsers);
|
||||||
} else {
|
} else {
|
||||||
@@ -1583,6 +1611,10 @@ class User
|
|||||||
$oCriteria->addAsColumn('DUE_DATE_OK', 1);
|
$oCriteria->addAsColumn('DUE_DATE_OK', 1);
|
||||||
$sep = "'";
|
$sep = "'";
|
||||||
$oCriteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN);
|
$oCriteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN);
|
||||||
|
|
||||||
|
//Remove the guest user
|
||||||
|
$oCriteria->add(UsersPeer::USR_UID, RBAC::GUEST_USER_UID, Criteria::NOT_EQUAL);
|
||||||
|
|
||||||
if ($filter != '') {
|
if ($filter != '') {
|
||||||
$cc = $oCriteria->getNewCriterion(UsersPeer::USR_USERNAME, '%' . $filter . '%', Criteria::LIKE)
|
$cc = $oCriteria->getNewCriterion(UsersPeer::USR_USERNAME, '%' . $filter . '%', Criteria::LIKE)
|
||||||
->addOr($oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME, '%' . $filter . '%', Criteria::LIKE)
|
->addOr($oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME, '%' . $filter . '%', Criteria::LIKE)
|
||||||
|
|||||||
@@ -9,6 +9,23 @@ use WebEntryPeer;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use G;
|
use G;
|
||||||
use BpmnFlowPeer;
|
use BpmnFlowPeer;
|
||||||
|
use ProcessMaker\BusinessModel\Process as BusinessModelProcess;
|
||||||
|
use ProcessMaker\BusinessModel\Validator as BusinessModelValidator;
|
||||||
|
use ProcessMaker\Project\Workflow;
|
||||||
|
use WebEntryEvent as ModelWebEntryEvent;
|
||||||
|
use ProcessMaker\Util\Common;
|
||||||
|
use Task as ModelTask;
|
||||||
|
use Propel;
|
||||||
|
use BasePeer;
|
||||||
|
use Content;
|
||||||
|
use Tasks;
|
||||||
|
use Step;
|
||||||
|
use TaskPeer;
|
||||||
|
use StepPeer;
|
||||||
|
use ResultSet;
|
||||||
|
use TaskUser;
|
||||||
|
use TaskUserPeer;
|
||||||
|
|
||||||
|
|
||||||
class WebEntryEvent
|
class WebEntryEvent
|
||||||
{
|
{
|
||||||
@@ -358,13 +375,7 @@ class WebEntryEvent
|
|||||||
|
|
||||||
$arrayFinalData = array_merge($arrayWebEntryEventData, $arrayData);
|
$arrayFinalData = array_merge($arrayWebEntryEventData, $arrayData);
|
||||||
|
|
||||||
//Verify data - Field definition
|
//Define the required dependent fields:
|
||||||
$process = new \ProcessMaker\BusinessModel\Process();
|
|
||||||
//Dependent fields:
|
|
||||||
if (!isset($arrayData['WE_AUTHENTICATION']) || $arrayData['WE_AUTHENTICATION']
|
|
||||||
== 'ANONYMOUS') {
|
|
||||||
$this->arrayFieldDefinition['USR_UID']['required'] = true;
|
|
||||||
}
|
|
||||||
if (!isset($arrayData['WE_TYPE']) || $arrayData['WE_TYPE']
|
if (!isset($arrayData['WE_TYPE']) || $arrayData['WE_TYPE']
|
||||||
== 'SINGLE') {
|
== 'SINGLE') {
|
||||||
$this->arrayFieldDefinition['DYN_UID']['required'] = true;
|
$this->arrayFieldDefinition['DYN_UID']['required'] = true;
|
||||||
@@ -391,6 +402,7 @@ class WebEntryEvent
|
|||||||
$this->arrayFieldDefinition['WE_LINK_LANGUAGE']['defaultValues'] = $languages;
|
$this->arrayFieldDefinition['WE_LINK_LANGUAGE']['defaultValues'] = $languages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$process = new BusinessModelProcess();
|
||||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition,
|
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition,
|
||||||
$this->arrayFieldNameForException, $flagInsert);
|
$this->arrayFieldNameForException, $flagInsert);
|
||||||
|
|
||||||
@@ -513,11 +525,11 @@ class WebEntryEvent
|
|||||||
$arrayEventData = $bpmn->getEvent($eventUid);
|
$arrayEventData = $bpmn->getEvent($eventUid);
|
||||||
|
|
||||||
//Task
|
//Task
|
||||||
$task = new \Task();
|
$task = new ModelTask();
|
||||||
|
|
||||||
$tasUid = static::getTaskUidFromEvnUid($eventUid);
|
$tasUid = static::getTaskUidFromEvnUid($eventUid);
|
||||||
|
|
||||||
if (\TaskPeer::retrieveByPK($tasUid)) {
|
if (TaskPeer::retrieveByPK($tasUid)) {
|
||||||
$this->webEntryEventWebEntryTaskUid = $tasUid;
|
$this->webEntryEventWebEntryTaskUid = $tasUid;
|
||||||
} else {
|
} else {
|
||||||
$this->webEntryEventWebEntryTaskUid = $task->create(
|
$this->webEntryEventWebEntryTaskUid = $task->create(
|
||||||
@@ -535,7 +547,7 @@ class WebEntryEvent
|
|||||||
|
|
||||||
if (!isset($arrayData['WE_TYPE']) || $arrayData['WE_TYPE'] === 'SINGLE') {
|
if (!isset($arrayData['WE_TYPE']) || $arrayData['WE_TYPE'] === 'SINGLE') {
|
||||||
//Task - Step
|
//Task - Step
|
||||||
$step = new \Step();
|
$step = new Step();
|
||||||
|
|
||||||
$stepUid = $step->create(array(
|
$stepUid = $step->create(array(
|
||||||
"PRO_UID" => $projectUid,
|
"PRO_UID" => $projectUid,
|
||||||
@@ -553,13 +565,13 @@ class WebEntryEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Task - User
|
//Task - User
|
||||||
$task = new \Tasks();
|
$task = new Tasks();
|
||||||
if (!(isset($arrayData['WE_AUTHENTICATION']) && $arrayData['WE_AUTHENTICATION'] === 'LOGIN_REQUIRED')) {
|
if (!(isset($arrayData['WE_AUTHENTICATION']) && $arrayData['WE_AUTHENTICATION'] === 'LOGIN_REQUIRED')) {
|
||||||
$task->assignUser($this->webEntryEventWebEntryTaskUid, $userUid, 1);
|
$task->assignUser($this->webEntryEventWebEntryTaskUid, $userUid, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Route
|
//Route
|
||||||
$workflow = \ProcessMaker\Project\Workflow::load($projectUid);
|
$workflow = Workflow::load($projectUid);
|
||||||
|
|
||||||
$result = $workflow->addRoute($this->webEntryEventWebEntryTaskUid, $activityUid, "SEQUENTIAL");
|
$result = $workflow->addRoute($this->webEntryEventWebEntryTaskUid, $activityUid, "SEQUENTIAL");
|
||||||
|
|
||||||
@@ -622,10 +634,10 @@ class WebEntryEvent
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if ($webEntryTaskUid != "") {
|
if ($webEntryTaskUid != "") {
|
||||||
$obj = \TaskPeer::retrieveByPK($webEntryTaskUid);
|
$obj = TaskPeer::retrieveByPK($webEntryTaskUid);
|
||||||
|
|
||||||
if (!is_null($obj)) {
|
if (!is_null($obj)) {
|
||||||
$task = new \Tasks();
|
$task = new Tasks();
|
||||||
|
|
||||||
$task->deleteTask($webEntryTaskUid);
|
$task->deleteTask($webEntryTaskUid);
|
||||||
}
|
}
|
||||||
@@ -657,8 +669,8 @@ class WebEntryEvent
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//Verify data
|
//Verify data
|
||||||
$process = new \ProcessMaker\BusinessModel\Process();
|
$process = new BusinessModelProcess();
|
||||||
$validator = new \ProcessMaker\BusinessModel\Validator();
|
$validator = new BusinessModelValidator();
|
||||||
|
|
||||||
$validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData");
|
$validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData");
|
||||||
$validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
|
$validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
|
||||||
@@ -693,17 +705,19 @@ class WebEntryEvent
|
|||||||
$arrayData["WEE_TITLE"] = null;
|
$arrayData["WEE_TITLE"] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Verify data
|
//Verify data related to the process
|
||||||
$process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]);
|
$process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]);
|
||||||
|
//Define if the webEntry need to use the guest user
|
||||||
|
$weUserUid = isset($arrayData["USR_UID"]) ? $arrayData["USR_UID"] : '';
|
||||||
|
$weAuthentication = isset($arrayData["WE_AUTHENTICATION"]) ? $arrayData["WE_AUTHENTICATION"] : '';
|
||||||
|
$arrayData["USR_UID"] = $this->getWebEntryUser($weAuthentication, $weUserUid);
|
||||||
|
//Verify data with the required fields
|
||||||
$this->throwExceptionIfDataIsInvalid("", $projectUid, $arrayData);
|
$this->throwExceptionIfDataIsInvalid("", $projectUid, $arrayData);
|
||||||
|
|
||||||
//Create
|
|
||||||
$cnn = \Propel::getConnection("workflow");
|
|
||||||
|
|
||||||
$this->webEntryEventWebEntryUid = "";
|
$this->webEntryEventWebEntryUid = "";
|
||||||
$this->webEntryEventWebEntryTaskUid = "";
|
$this->webEntryEventWebEntryTaskUid = "";
|
||||||
|
//Create the connection
|
||||||
|
$cnn = Propel::getConnection("workflow");
|
||||||
try {
|
try {
|
||||||
//WebEntry
|
//WebEntry
|
||||||
$this->createWebEntry(
|
$this->createWebEntry(
|
||||||
@@ -719,11 +733,11 @@ class WebEntryEvent
|
|||||||
);
|
);
|
||||||
|
|
||||||
//WebEntry-Event
|
//WebEntry-Event
|
||||||
$webEntryEvent = new \WebEntryEvent();
|
$webEntryEvent = new ModelWebEntryEvent();
|
||||||
|
|
||||||
$webEntryEvent->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
|
$webEntryEvent->fromArray($arrayData, BasePeer::TYPE_FIELDNAME);
|
||||||
|
|
||||||
$webEntryEventUid = \ProcessMaker\Util\Common::generateUID();
|
$webEntryEventUid = Common::generateUID();
|
||||||
|
|
||||||
$webEntryEvent->setWeeUid($webEntryEventUid);
|
$webEntryEvent->setWeeUid($webEntryEventUid);
|
||||||
$webEntryEvent->setPrjUid($projectUid);
|
$webEntryEvent->setPrjUid($projectUid);
|
||||||
@@ -739,13 +753,13 @@ class WebEntryEvent
|
|||||||
|
|
||||||
//Set WEE_TITLE
|
//Set WEE_TITLE
|
||||||
if (isset($arrayData["WEE_TITLE"])) {
|
if (isset($arrayData["WEE_TITLE"])) {
|
||||||
$result = \Content::addContent("WEE_TITLE", "", $webEntryEventUid, SYS_LANG,
|
$result = Content::addContent("WEE_TITLE", "", $webEntryEventUid, SYS_LANG,
|
||||||
$arrayData["WEE_TITLE"]);
|
$arrayData["WEE_TITLE"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set WEE_DESCRIPTION
|
//Set WEE_DESCRIPTION
|
||||||
if (isset($arrayData["WEE_DESCRIPTION"])) {
|
if (isset($arrayData["WEE_DESCRIPTION"])) {
|
||||||
$result = \Content::addContent("WEE_DESCRIPTION", "", $webEntryEventUid, SYS_LANG,
|
$result = Content::addContent("WEE_DESCRIPTION", "", $webEntryEventUid, SYS_LANG,
|
||||||
$arrayData["WEE_DESCRIPTION"]);
|
$arrayData["WEE_DESCRIPTION"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -782,12 +796,12 @@ class WebEntryEvent
|
|||||||
* @return array Return data of the WebEntry-Event updated
|
* @return array Return data of the WebEntry-Event updated
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function update($webEntryEventUid, $userUidUpdater, array $arrayData)
|
public function update($webEntryEventUid, $userUidUpdater, array $arrayData, $updateUser = true)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//Verify data
|
//Verify data
|
||||||
$process = new \ProcessMaker\BusinessModel\Process();
|
$process = new BusinessModelProcess();
|
||||||
$validator = new \ProcessMaker\BusinessModel\Validator();
|
$validator = new BusinessModelValidator();
|
||||||
|
|
||||||
$validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData");
|
$validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData");
|
||||||
$validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
|
$validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
|
||||||
@@ -806,14 +820,20 @@ class WebEntryEvent
|
|||||||
|
|
||||||
$arrayFinalData = array_merge($arrayWebEntryEventData, $arrayData);
|
$arrayFinalData = array_merge($arrayWebEntryEventData, $arrayData);
|
||||||
|
|
||||||
//Verify data
|
//Verify data related to the process
|
||||||
$this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid,
|
$this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid,
|
||||||
$this->arrayFieldNameForException["webEntryEventUid"]);
|
$this->arrayFieldNameForException["webEntryEventUid"]);
|
||||||
|
//Define if the webEntry need to use the guest user
|
||||||
|
$weUserUid = isset($arrayData["USR_UID"]) ? $arrayData["USR_UID"] : '';
|
||||||
|
$weAuthentication = isset($arrayData["WE_AUTHENTICATION"]) ? $arrayData["WE_AUTHENTICATION"] : '';
|
||||||
|
if ($updateUser) {
|
||||||
|
$arrayData["USR_UID"] = $this->getWebEntryUser($weAuthentication, $weUserUid);
|
||||||
|
}
|
||||||
|
//Verify data with the required fields
|
||||||
$this->throwExceptionIfDataIsInvalid($webEntryEventUid, $arrayWebEntryEventData["PRJ_UID"], $arrayData);
|
$this->throwExceptionIfDataIsInvalid($webEntryEventUid, $arrayWebEntryEventData["PRJ_UID"], $arrayData);
|
||||||
|
|
||||||
//Update
|
//Update
|
||||||
$cnn = \Propel::getConnection("workflow");
|
$cnn = Propel::getConnection("workflow");
|
||||||
|
|
||||||
$this->webEntryEventWebEntryUid = "";
|
$this->webEntryEventWebEntryUid = "";
|
||||||
$this->webEntryEventWebEntryTaskUid = "";
|
$this->webEntryEventWebEntryTaskUid = "";
|
||||||
@@ -821,20 +841,20 @@ class WebEntryEvent
|
|||||||
try {
|
try {
|
||||||
//WebEntry
|
//WebEntry
|
||||||
if ($arrayWebEntryEventData["WEE_WE_UID"] != "") {
|
if ($arrayWebEntryEventData["WEE_WE_UID"] != "") {
|
||||||
$task = new \Tasks();
|
$task = new Tasks();
|
||||||
|
|
||||||
//Task - Step for WE_TYPE=SINGLE
|
//Task - Step for WE_TYPE=SINGLE
|
||||||
$weType = !empty($arrayData["WE_TYPE"]) ? $arrayData["WE_TYPE"] : $arrayWebEntryEventData["WE_TYPE"];
|
$weType = !empty($arrayData["WE_TYPE"]) ? $arrayData["WE_TYPE"] : $arrayWebEntryEventData["WE_TYPE"];
|
||||||
if (isset($arrayData["DYN_UID"]) && $arrayData["DYN_UID"] !== $arrayWebEntryEventData["DYN_UID"] && $weType === 'SINGLE') {
|
if (isset($arrayData["DYN_UID"]) && $arrayData["DYN_UID"] !== $arrayWebEntryEventData["DYN_UID"] && $weType === 'SINGLE') {
|
||||||
//Delete
|
//Delete
|
||||||
$step = new \Step();
|
$step = new Step();
|
||||||
|
|
||||||
$criteria = new Criteria("workflow");
|
$criteria = new Criteria("workflow");
|
||||||
|
|
||||||
$criteria->add(\StepPeer::TAS_UID, $arrayWebEntryEventData["WEE_WE_TAS_UID"]);
|
$criteria->add(StepPeer::TAS_UID, $arrayWebEntryEventData["WEE_WE_TAS_UID"]);
|
||||||
|
|
||||||
$rsCriteria = \StepPeer::doSelectRS($criteria);
|
$rsCriteria = StepPeer::doSelectRS($criteria);
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
while ($rsCriteria->next()) {
|
while ($rsCriteria->next()) {
|
||||||
$row = $rsCriteria->getRow();
|
$row = $rsCriteria->getRow();
|
||||||
@@ -843,7 +863,7 @@ class WebEntryEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Add
|
//Add
|
||||||
$step = new \Step();
|
$step = new Step();
|
||||||
|
|
||||||
$stepUid = $step->create(array(
|
$stepUid = $step->create(array(
|
||||||
"PRO_UID" => $arrayWebEntryEventData["PRJ_UID"],
|
"PRO_UID" => $arrayWebEntryEventData["PRJ_UID"],
|
||||||
@@ -859,16 +879,21 @@ class WebEntryEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Task - User
|
//Task - User
|
||||||
if (!empty($arrayData["USR_UID"]) && $arrayData["USR_UID"] != $arrayWebEntryEventData["USR_UID"]) {
|
$proUser = new ProjectUser();
|
||||||
|
$newUser = !empty($arrayData["USR_UID"]) ? $arrayData["USR_UID"] : "";
|
||||||
|
$oldUser = $arrayWebEntryEventData["USR_UID"];
|
||||||
|
$isAssigned = $proUser->userIsAssignedToTask($newUser, $arrayWebEntryEventData["WEE_WE_TAS_UID"]);
|
||||||
|
$shouldUpdate = !empty($newUser) && ($newUser !== $oldUser || !$isAssigned);
|
||||||
|
if ($shouldUpdate) {
|
||||||
//Unassign
|
//Unassign
|
||||||
$taskUser = new \TaskUser();
|
$taskUser = new TaskUser();
|
||||||
|
|
||||||
$criteria = new Criteria("workflow");
|
$criteria = new Criteria("workflow");
|
||||||
|
|
||||||
$criteria->add(\TaskUserPeer::TAS_UID, $arrayWebEntryEventData["WEE_WE_TAS_UID"]);
|
$criteria->add(TaskUserPeer::TAS_UID, $arrayWebEntryEventData["WEE_WE_TAS_UID"]);
|
||||||
|
|
||||||
$rsCriteria = \TaskUserPeer::doSelectRS($criteria);
|
$rsCriteria = TaskUserPeer::doSelectRS($criteria);
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
while ($rsCriteria->next()) {
|
while ($rsCriteria->next()) {
|
||||||
$row = $rsCriteria->getRow();
|
$row = $rsCriteria->getRow();
|
||||||
@@ -878,8 +903,11 @@ class WebEntryEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Assign
|
//Assign
|
||||||
$result = $task->assignUser($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["USR_UID"],
|
$result = $task->assignUser(
|
||||||
1);
|
$arrayWebEntryEventData["WEE_WE_TAS_UID"],
|
||||||
|
$arrayData["USR_UID"],
|
||||||
|
1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Route
|
//Route
|
||||||
@@ -892,7 +920,7 @@ class WebEntryEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Add
|
//Add
|
||||||
$workflow = \ProcessMaker\Project\Workflow::load($arrayWebEntryEventData["PRJ_UID"]);
|
$workflow = Workflow::load($arrayWebEntryEventData["PRJ_UID"]);
|
||||||
|
|
||||||
$result = $workflow->addRoute($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["ACT_UID"],
|
$result = $workflow->addRoute($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["ACT_UID"],
|
||||||
"SEQUENTIAL");
|
"SEQUENTIAL");
|
||||||
@@ -925,15 +953,18 @@ class WebEntryEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (count($arrayDataAux) > 0) {
|
if (count($arrayDataAux) > 0) {
|
||||||
$arrayDataAux = $this->webEntry->update($arrayWebEntryEventData["WEE_WE_UID"], $userUidUpdater,
|
$arrayDataAux = $this->webEntry->update(
|
||||||
$arrayDataAux);
|
$arrayWebEntryEventData["WEE_WE_UID"],
|
||||||
|
$userUidUpdater,
|
||||||
|
$arrayDataAux
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//WebEntry-Event
|
//WebEntry-Event
|
||||||
$webEntryEvent = WebEntryEventPeer::retrieveByPK($webEntryEventUid);
|
$webEntryEvent = WebEntryEventPeer::retrieveByPK($webEntryEventUid);
|
||||||
|
|
||||||
$webEntryEvent->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
|
$webEntryEvent->fromArray($arrayData, BasePeer::TYPE_FIELDNAME);
|
||||||
|
|
||||||
if ($webEntryEvent->validate()) {
|
if ($webEntryEvent->validate()) {
|
||||||
$cnn->begin();
|
$cnn->begin();
|
||||||
@@ -944,13 +975,13 @@ class WebEntryEvent
|
|||||||
|
|
||||||
//Set WEE_TITLE
|
//Set WEE_TITLE
|
||||||
if (isset($arrayData["WEE_TITLE"])) {
|
if (isset($arrayData["WEE_TITLE"])) {
|
||||||
$result = \Content::addContent("WEE_TITLE", "", $webEntryEventUid, SYS_LANG,
|
$result = Content::addContent("WEE_TITLE", "", $webEntryEventUid, SYS_LANG,
|
||||||
$arrayData["WEE_TITLE"]);
|
$arrayData["WEE_TITLE"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set WEE_DESCRIPTION
|
//Set WEE_DESCRIPTION
|
||||||
if (isset($arrayData["WEE_DESCRIPTION"])) {
|
if (isset($arrayData["WEE_DESCRIPTION"])) {
|
||||||
$result = \Content::addContent("WEE_DESCRIPTION", "", $webEntryEventUid, SYS_LANG,
|
$result = Content::addContent("WEE_DESCRIPTION", "", $webEntryEventUid, SYS_LANG,
|
||||||
$arrayData["WEE_DESCRIPTION"]);
|
$arrayData["WEE_DESCRIPTION"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1123,7 +1154,7 @@ class WebEntryEvent
|
|||||||
$arrayWebEntryEvent = array();
|
$arrayWebEntryEvent = array();
|
||||||
|
|
||||||
//Verify data
|
//Verify data
|
||||||
$process = new \ProcessMaker\BusinessModel\Process();
|
$process = new BusinessModelProcess();
|
||||||
|
|
||||||
$process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]);
|
$process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]);
|
||||||
|
|
||||||
@@ -1133,7 +1164,7 @@ class WebEntryEvent
|
|||||||
$criteria->add(WebEntryEventPeer::PRJ_UID, $projectUid, Criteria::EQUAL);
|
$criteria->add(WebEntryEventPeer::PRJ_UID, $projectUid, Criteria::EQUAL);
|
||||||
|
|
||||||
$rsCriteria = WebEntryEventPeer::doSelectRS($criteria);
|
$rsCriteria = WebEntryEventPeer::doSelectRS($criteria);
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
while ($rsCriteria->next()) {
|
while ($rsCriteria->next()) {
|
||||||
$row = $rsCriteria->getRow();
|
$row = $rsCriteria->getRow();
|
||||||
@@ -1174,7 +1205,7 @@ class WebEntryEvent
|
|||||||
}
|
}
|
||||||
$criteria->add(ProcessPeer::PRO_STATUS, 'ACTIVE', Criteria::EQUAL);
|
$criteria->add(ProcessPeer::PRO_STATUS, 'ACTIVE', Criteria::EQUAL);
|
||||||
$rsCriteria = WebEntryEventPeer::doSelectRS($criteria);
|
$rsCriteria = WebEntryEventPeer::doSelectRS($criteria);
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
while ($rsCriteria->next()) {
|
while ($rsCriteria->next()) {
|
||||||
$row = $rsCriteria->getRow();
|
$row = $rsCriteria->getRow();
|
||||||
$result[] = $this->getWebEntryEventDataFromRecord($row);
|
$result[] = $this->getWebEntryEventDataFromRecord($row);
|
||||||
@@ -1208,7 +1239,7 @@ class WebEntryEvent
|
|||||||
$criteria->add(WebEntryEventPeer::WEE_UID, $webEntryEventUid, Criteria::EQUAL);
|
$criteria->add(WebEntryEventPeer::WEE_UID, $webEntryEventUid, Criteria::EQUAL);
|
||||||
|
|
||||||
$rsCriteria = WebEntryEventPeer::doSelectRS($criteria);
|
$rsCriteria = WebEntryEventPeer::doSelectRS($criteria);
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
$rsCriteria->next();
|
$rsCriteria->next();
|
||||||
|
|
||||||
@@ -1235,7 +1266,7 @@ class WebEntryEvent
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//Verify data
|
//Verify data
|
||||||
$process = new \ProcessMaker\BusinessModel\Process();
|
$process = new BusinessModelProcess();
|
||||||
|
|
||||||
$process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]);
|
$process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]);
|
||||||
|
|
||||||
@@ -1251,7 +1282,7 @@ class WebEntryEvent
|
|||||||
$criteria->add(WebEntryEventPeer::EVN_UID, $eventUid, Criteria::EQUAL);
|
$criteria->add(WebEntryEventPeer::EVN_UID, $eventUid, Criteria::EQUAL);
|
||||||
|
|
||||||
$rsCriteria = WebEntryEventPeer::doSelectRS($criteria);
|
$rsCriteria = WebEntryEventPeer::doSelectRS($criteria);
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
$rsCriteria->next();
|
$rsCriteria->next();
|
||||||
|
|
||||||
@@ -1361,4 +1392,22 @@ class WebEntryEvent
|
|||||||
return $url . "/" . $weData;
|
return $url . "/" . $weData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function return the uid of user related to the webEntry
|
||||||
|
* @param string $authentication, can be ANONYMOUS, LOGIN_REQUIRED
|
||||||
|
* @param string $usrUid
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getWebEntryUser($authentication = 'ANONYMOUS', $usrUid = '')
|
||||||
|
{
|
||||||
|
//The webEntry old does not have type of authentication defined
|
||||||
|
//The webEntry2.0 can be has values ANONYMOUS or LOGIN_REQUIRED
|
||||||
|
if ($authentication === 'ANONYMOUS' || empty($authentication)) {
|
||||||
|
$user = new User();
|
||||||
|
return $user->getGuestUser();
|
||||||
|
} else {
|
||||||
|
return $usrUid;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2086,7 +2086,8 @@ class BpmnWorkflow extends Project\Bpmn
|
|||||||
$arrayResult = $webEntryEvent->update(
|
$arrayResult = $webEntryEvent->update(
|
||||||
$arrayWebEntryEventData['WEE_UID'],
|
$arrayWebEntryEventData['WEE_UID'],
|
||||||
$bpmnProject->getPrjAuthor(),
|
$bpmnProject->getPrjAuthor(),
|
||||||
(!is_null($arrayData))? $arrayData : $arrayWebEntryEventData
|
(!is_null($arrayData))? $arrayData : $arrayWebEntryEventData,
|
||||||
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user