Merged in bugfix/PMC-985 (pull request #6988)
PMC-985 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -18338,8 +18338,8 @@ msgstr "MEMBER OF"
|
||||
# TRANSLATION
|
||||
# LABEL/ID_MEMORY_LIMIT
|
||||
#: LABEL/ID_MEMORY_LIMIT
|
||||
msgid "Memory Limit (Mb)"
|
||||
msgstr "Memory Limit (Mb)"
|
||||
msgid "Memory Limit (MB)"
|
||||
msgstr "Memory Limit (MB)"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_MEMORY_LIMIT_VALIDATE
|
||||
@@ -21470,8 +21470,8 @@ msgstr "LDAP is optional"
|
||||
# TRANSLATION
|
||||
# LABEL/ID_PROCESSMAKER_REQUIREMENTS_MEMORYLIMIT
|
||||
#: LABEL/ID_PROCESSMAKER_REQUIREMENTS_MEMORYLIMIT
|
||||
msgid "Memory Limit >= 80M"
|
||||
msgstr "Memory Limit >= 80M"
|
||||
msgid "Memory Limit >= 80MB"
|
||||
msgstr "Memory Limit >= 80MB"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_PROCESSMAKER_REQUIREMENTS_MSSQL
|
||||
|
||||
2
workflow/engine/controllers/InstallerModule.php
Normal file → Executable file
2
workflow/engine/controllers/InstallerModule.php
Normal file → Executable file
@@ -295,7 +295,7 @@ class InstallerModule extends Controller
|
||||
|
||||
// memory limit verification
|
||||
$memory = (int)ini_get('memory_limit');
|
||||
$info->memory->version = $memory . 'M';
|
||||
$info->memory->version = changeAbbreviationOfDirectives(ini_get('memory_limit'));
|
||||
$info->memory->result = $memory > 255;
|
||||
|
||||
return $info;
|
||||
|
||||
@@ -59918,7 +59918,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_MEMBER','en','Member','2014-01-15') ,
|
||||
( 'LABEL','ID_MEMBERS','en','Members','2014-01-15') ,
|
||||
( 'LABEL','ID_MEMBER_OF','en','MEMBER OF','2014-01-15') ,
|
||||
( 'LABEL','ID_MEMORY_LIMIT','en','Memory Limit (Mb)','2014-01-15') ,
|
||||
( 'LABEL','ID_MEMORY_LIMIT','en','Memory Limit (MB)','2014-01-15') ,
|
||||
( 'LABEL','ID_MEMORY_LIMIT_VALIDATE','en','Memory Limit value has to be either a positive integer or -1','2017-04-05') ,
|
||||
( 'LABEL','ID_MENU_NAME','en','Enterprise Manager','2014-10-17') ,
|
||||
( 'LABEL','ID_MESSAGE','en','Message','2014-01-15') ,
|
||||
@@ -60455,7 +60455,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_GD','en','GD Support','2014-01-15') ,
|
||||
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_LDAP','en','LDAP Support (*)','2014-01-15') ,
|
||||
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_LDAP_OPTIONAL','en','LDAP is optional','2014-01-15') ,
|
||||
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_MEMORYLIMIT','en','Memory Limit >= 80M','2014-01-15') ,
|
||||
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_MEMORYLIMIT','en','Memory Limit >= 80MB','2014-01-15') ,
|
||||
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_MSSQL','en','MSSQL Support (*)','2014-01-15') ,
|
||||
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_MULTIBYTESTRING','en','Multibyte Strings Support','2014-01-15') ,
|
||||
( 'LABEL','ID_PROCESSMAKER_REQUIREMENTS_MYSQL','en','MySQL Support','2014-01-15') ,
|
||||
|
||||
@@ -326,6 +326,8 @@ try {
|
||||
}
|
||||
|
||||
if ($RBAC->singleSignOn) {
|
||||
// Update the User's last login date
|
||||
updateUserLastLogin($aLog);
|
||||
G::header('Location: ' . $sLocation);
|
||||
die();
|
||||
}
|
||||
@@ -336,6 +338,8 @@ try {
|
||||
if ($changePassword === true) {
|
||||
$user = new User();
|
||||
$currentUser = $user->changePassword($_SESSION['USER_LOGGED'], $_POST['form']['USR_PASSWORD']);
|
||||
// Update the User's last login date
|
||||
updateUserLastLogin($aLog);
|
||||
G::header('Location: ' . $currentUser["__REDIRECT_PATH__"]);
|
||||
return;
|
||||
}
|
||||
@@ -394,6 +398,9 @@ try {
|
||||
setcookie("PM-TabPrimary", 101010010, time() + (24 * 60 * 60), '/');
|
||||
}
|
||||
|
||||
// Update the User's last login date
|
||||
updateUserLastLogin($aLog);
|
||||
|
||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||
if ($oPluginRegistry->existsTrigger ( PM_AFTER_LOGIN )) {
|
||||
$oPluginRegistry->executeTriggers ( PM_AFTER_LOGIN , $_SESSION['USER_LOGGED'] );
|
||||
|
||||
@@ -116,12 +116,6 @@ if (isset($_SESSION['USER_LOGGED'])) {
|
||||
$aLog['USR_UID'] = $aRow['USR_UID'];
|
||||
|
||||
$weblog->update($aLog);
|
||||
|
||||
$aLog = array();
|
||||
$aLog['USR_UID'] = $aRow['USR_UID'];
|
||||
$aLog['USR_LAST_LOGIN'] = $endDate;
|
||||
$user = new Users();
|
||||
$aUser = $user->update($aLog);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
5
workflow/engine/methods/users/usersEdit.php
Normal file → Executable file
5
workflow/engine/methods/users/usersEdit.php
Normal file → Executable file
@@ -19,6 +19,9 @@ $mul = substr($UPLOAD_MAX_SIZE, - 1);
|
||||
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
|
||||
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
|
||||
|
||||
//We need to use the following abbreviations: Bytes, KB, MB, GB
|
||||
$maxFileSize = changeAbbreviationOfDirectives(ini_get('upload_max_filesize'));
|
||||
|
||||
if ($postMaxSize < $uploadMaxSize) {
|
||||
$uploadMaxSize = $postMaxSize;
|
||||
}
|
||||
@@ -46,7 +49,7 @@ $oHeadPublisher = headPublisher::getSingleton();
|
||||
$oHeadPublisher->addExtJsScript('users/users', true); //adding a javascript file .js
|
||||
$oHeadPublisher->assign('USR_UID', $_GET['USR_UID']);
|
||||
$oHeadPublisher->assign('MODE', $_GET['MODE']);
|
||||
$oHeadPublisher->assign('MAX_FILES_SIZE', ' (' . $UPLOAD_MAX_SIZE . ') ');
|
||||
$oHeadPublisher->assign('MAX_FILES_SIZE', ' (' . $maxFileSize . ') ');
|
||||
$oHeadPublisher->assign('SYSTEM_TIME_ZONE', $arraySystemConfiguration['time_zone']);
|
||||
$oHeadPublisher->assign('TIME_ZONE_DATA', array_map(function ($value) {
|
||||
return [$value, $value];
|
||||
|
||||
5
workflow/engine/methods/users/usersInit.php
Normal file → Executable file
5
workflow/engine/methods/users/usersInit.php
Normal file → Executable file
@@ -27,6 +27,9 @@ $mul = substr($UPLOAD_MAX_SIZE, - 1);
|
||||
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
|
||||
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
|
||||
|
||||
//We need to use the following abbreviations: Bytes, KB, MB, GB
|
||||
$maxFileSize = changeAbbreviationOfDirectives(ini_get('upload_max_filesize'));
|
||||
|
||||
if ($postMaxSize < $uploadMaxSize) {
|
||||
$uploadMaxSize = $postMaxSize;
|
||||
}
|
||||
@@ -58,7 +61,7 @@ $oHeadPublisher->assign('infoMode', true);
|
||||
$oHeadPublisher->assign('EDITPROFILE', 1);
|
||||
$oHeadPublisher->assign('canEdit', $canEdit);
|
||||
$oHeadPublisher->assign('canEditCalendar', $canEditCalendar);
|
||||
$oHeadPublisher->assign('MAX_FILES_SIZE', ' (' . $UPLOAD_MAX_SIZE . ') ');
|
||||
$oHeadPublisher->assign('MAX_FILES_SIZE', ' (' . $maxFileSize . ') ');
|
||||
$oHeadPublisher->assign('MODE', '');
|
||||
$oHeadPublisher->assign('SYSTEM_TIME_ZONE', $arraySystemConfiguration['time_zone']);
|
||||
$oHeadPublisher->assign('TIME_ZONE_DATA', array_map(function ($value) {
|
||||
|
||||
5
workflow/engine/methods/users/usersNew.php
Normal file → Executable file
5
workflow/engine/methods/users/usersNew.php
Normal file → Executable file
@@ -16,6 +16,9 @@ $mul = substr($UPLOAD_MAX_SIZE, - 1);
|
||||
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
|
||||
$uploadMaxSize = (int) $UPLOAD_MAX_SIZE * $mul;
|
||||
|
||||
//We need to use the following abbreviations: Bytes, KB, MB, GB
|
||||
$maxFileSize = changeAbbreviationOfDirectives(ini_get('upload_max_filesize'));
|
||||
|
||||
if ($postMaxSize < $uploadMaxSize) {
|
||||
$uploadMaxSize = $postMaxSize;
|
||||
}
|
||||
@@ -44,7 +47,7 @@ $oHeadPublisher = headPublisher::getSingleton();
|
||||
$oHeadPublisher->addExtJsScript('users/users', true); //adding a javascript file .js
|
||||
$oHeadPublisher->assign('USR_UID', '');
|
||||
$oHeadPublisher->assign('MODE', $_GET['MODE']);
|
||||
$oHeadPublisher->assign('MAX_FILES_SIZE', ' (' . $UPLOAD_MAX_SIZE . ') ');
|
||||
$oHeadPublisher->assign('MAX_FILES_SIZE', ' (' . $maxFileSize . ') ');
|
||||
$oHeadPublisher->assign('SYSTEM_TIME_ZONE', $arraySystemConfiguration['time_zone']);
|
||||
$oHeadPublisher->assign('TIME_ZONE_DATA', array_map(function ($value) {
|
||||
return [$value, $value];
|
||||
|
||||
@@ -196,7 +196,7 @@ class FilesLogs extends Files
|
||||
*/
|
||||
private function size($size, $format = null)
|
||||
{
|
||||
$sizes = ['Bytes', 'Kbytes', 'Mbytes', 'Gbytes', 'Tbytes', 'Pbytes', 'Ebytes', 'Zbytes', 'Ybytes'];
|
||||
$sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
if ($format === null) {
|
||||
$format = ' % 01.2f % s';
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ abstract class Importer
|
||||
public function import($option = self::IMPORT_OPTION_CREATE_NEW, $optionGroup = self::GROUP_IMPORT_OPTION_CREATE_NEW, $generateUidFromJs = null, $objectsToImport = '')
|
||||
{
|
||||
$this->prepare();
|
||||
$keepCreateDate = false;
|
||||
//Verify data
|
||||
switch ($option) {
|
||||
case self::IMPORT_OPTION_CREATE_NEW:
|
||||
@@ -126,6 +127,7 @@ abstract class Importer
|
||||
case self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW:
|
||||
break;
|
||||
case self::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW:
|
||||
$keepCreateDate = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -258,12 +260,15 @@ abstract class Importer
|
||||
$this->importData["tables"]["workflow"]["process"] = $this->importData["tables"]["workflow"]["process"][0];
|
||||
|
||||
//Import
|
||||
if(!empty($generateUidFromJs)) {
|
||||
if (!empty($generateUidFromJs)) {
|
||||
$generateUid = $generateUidFromJs;
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
//Granular Import
|
||||
try {
|
||||
if ($generateUidFromJs || $keepCreateDate) {
|
||||
unset($this->importData["tables"]["workflow"]["process"]["PRO_CREATE_DATE"]);
|
||||
}
|
||||
if ($objectsToImport !== '') {
|
||||
$granularObj = new \ProcessMaker\BusinessModel\Migrator\GranularImporter();
|
||||
$newObjectArray = $objectsToImport;
|
||||
@@ -651,7 +656,9 @@ abstract class Importer
|
||||
}
|
||||
|
||||
unset($arrayWorkflowTables["process"]["PRO_CREATE_USER"]);
|
||||
unset($arrayWorkflowTables["process"]["PRO_CREATE_DATE"]);
|
||||
if ($generateUid) {
|
||||
unset($arrayWorkflowTables["process"]["PRO_CREATE_DATE"]);
|
||||
}
|
||||
unset($arrayWorkflowTables["process"]["PRO_UPDATE_DATE"]);
|
||||
|
||||
if ($flagDeleteCategory) {
|
||||
|
||||
14
workflow/engine/src/ProcessMaker/Model/BpmnProject.php
Normal file
14
workflow/engine/src/ProcessMaker/Model/BpmnProject.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BpmnProject extends Model
|
||||
{
|
||||
// Set our table name
|
||||
protected $table = 'BPMN_PROJECT';
|
||||
protected $primaryKey = 'PRJ_UID';
|
||||
// We do not have create/update timestamps for this table
|
||||
public $timestamps = false;
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Exception;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
@@ -39,4 +40,26 @@ class User extends Model
|
||||
{
|
||||
return User::find($usrUid)->groups()->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope for the specified user
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param array $filters
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
* @throws Exception
|
||||
*/
|
||||
public function scopeUserFilters($query, array $filters)
|
||||
{
|
||||
if (!empty($filters['USR_ID'])) {
|
||||
$query->where('USR_ID', $filters['USR_ID']);
|
||||
} elseif (!empty($filters['USR_UID'])) {
|
||||
$query->where('USR_UID', $filters['USR_UID']);
|
||||
} else {
|
||||
throw new Exception("There are no filter for loading a user model");
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
||||
50
workflow/engine/src/ProcessMaker/Util/helpers.php
Normal file → Executable file
50
workflow/engine/src/ProcessMaker/Util/helpers.php
Normal file → Executable file
@@ -2,6 +2,7 @@
|
||||
|
||||
use Illuminate\Session\TokenMismatchException;
|
||||
use Illuminate\Support\Str;
|
||||
use ProcessMaker\Model\User;
|
||||
|
||||
/**
|
||||
* We will send a case note in the actions by email
|
||||
@@ -450,6 +451,29 @@ function replacePrefixes($outDocFilename, $prefix = '@=')
|
||||
return $outDocFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the abbreviation of directives used in the php.ini configuration
|
||||
*
|
||||
* @param string $size
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function changeAbbreviationOfDirectives($size)
|
||||
{
|
||||
$sizeValue = (int)$size;
|
||||
|
||||
switch (substr($size, -1)) {
|
||||
case 'K':
|
||||
return $sizeValue . 'KB';
|
||||
case 'M':
|
||||
return $sizeValue . 'MB';
|
||||
case 'G':
|
||||
return $sizeValue . 'GB';
|
||||
default:
|
||||
return $sizeValue . 'Bytes';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Encoding header filename used in Content-Disposition
|
||||
*
|
||||
@@ -493,3 +517,29 @@ if (!function_exists('set_magic_quotes_runtime')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the USER table with the last login date
|
||||
*
|
||||
* @param array $userLog
|
||||
* @return int
|
||||
* @throws Exception
|
||||
*
|
||||
* @see workflow/engine/methods/login/authentication.php
|
||||
*/
|
||||
function updateUserLastLogin($userLog, $keyLastLogin = 'LOG_INIT_DATE')
|
||||
{
|
||||
try {
|
||||
$filters = [];
|
||||
$filters['USR_UID'] = $userLog['USR_UID'];
|
||||
|
||||
$user = User::query();
|
||||
$user->userFilters($filters);
|
||||
$res = $user->update(['USR_LAST_LOGIN' => $userLog[$keyLastLogin]]);
|
||||
|
||||
return $res;
|
||||
} catch (Exception $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user