diff --git a/config/app.php b/config/app.php index e036a5ab0..69bf9504e 100644 --- a/config/app.php +++ b/config/app.php @@ -10,6 +10,7 @@ return [ 'debug' => env('APP_DEBUG', false), 'log' => env('APP_LOG', 'single'), 'log_level' => env('APP_LOG_LEVEL', 'debug'), + 'cache_lifetime' => env('APP_CACHE_LIFETIME', 60), 'providers' => [ FilesystemServiceProvider::class, diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index effe5f3af..a4faf6502 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -2592,7 +2592,7 @@ class Bootstrap $hashTypePrevious = $passwordHashConfig['previous']; $acceptance = false; - if ($RBAC->loginWithHash()) { + if ($RBAC != null && $RBAC->loginWithHash()) { //To enable compatibility with soap login if ((Bootstrap::hashPassword($pass, $hashTypeCurrent) == $userPass) || ($pass === $hashTypeCurrent . ':' . $userPass)) { $acceptance = true; diff --git a/rbac/engine/classes/model/RbacUsers.php b/rbac/engine/classes/model/RbacUsers.php index 2f2d547b7..9e76fd516 100644 --- a/rbac/engine/classes/model/RbacUsers.php +++ b/rbac/engine/classes/model/RbacUsers.php @@ -184,9 +184,10 @@ class RbacUsers extends BaseRbacUsers try { $c = new Criteria('rbac'); $c->add(RbacUsersPeer::USR_UID, $sUsrUid); - $rs = RbacUsersPeer::doSelect($c, Propel::getDbConnection('rbac_ro')); - if (is_array($rs) && isset($rs[0]) && is_object($rs[0]) && get_class($rs[0]) == 'RbacUsers') { - $aFields = $rs[0]->toArray(BasePeer::TYPE_FIELDNAME); + $resultSet = RbacUsersPeer::doSelectRS($c, Propel::getDbConnection('rbac_ro')); + if ($resultSet->next()) { + $this->hydrate($resultSet); + $aFields = $this->toArray(BasePeer::TYPE_FIELDNAME); return $aFields; } return false; @@ -326,10 +327,14 @@ class RbacUsers extends BaseRbacUsers * * @param string $keyType One of the class type constants TYPE_PHPNAME, * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @param boolean $original If true return de original verion of fields. * @return an associative array containing the field names (as keys) and field values */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME) + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $original = false) { + if ($original) { + return parent::toArray($keyType); + } $key = RbacUsersPeer::translateFieldName( RbacUsersPeer::USR_PASSWORD, BasePeer::TYPE_COLNAME, diff --git a/workflow/engine/bin/tasks/cliCommon.php b/workflow/engine/bin/tasks/cliCommon.php index c902dcf9d..dce0e93ba 100644 --- a/workflow/engine/bin/tasks/cliCommon.php +++ b/workflow/engine/bin/tasks/cliCommon.php @@ -1,36 +1,11 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - * @author Alexandre Rosenfeld - * @package workflow-engine-bin-tasks - */ /* Get the size of the terminal (only works on Linux, on Windows it's always 80) */ preg_match_all("/rows.([0-9]+);.columns.([0-9]+);/", strtolower(exec('stty -a |grep columns')), $output); -if(sizeof($output) == 3 && isset($output[2]) && isset($output[2][0])) { - define("COLUMNS", $output[2][0]); +if (sizeof($output) == 3 && isset($output[2]) && isset($output[2][0])) { + define("COLUMNS", $output[2][0]); } else { - define("COLUMNS", 80); + define("COLUMNS", 80); } /** @@ -41,15 +16,9 @@ if(sizeof($output) == 3 && isset($output[2]) && isset($output[2][0])) { * returns all available workspaces * @return array of workspace objects */ -function get_workspaces_from_args($args, $includeAll = true) { - $workspaces = array(); - foreach ($args as $arg) { - $workspaces[] = new workspaceTools($arg); - } - if (empty($workspaces) && $includeAll) { - $workspaces = PmSystem::listWorkspaces(); - } - return $workspaces; +function get_workspaces_from_args($args, $includeAll = true) +{ + return \ProcessMaker\Util\System::getWorkspacesFromArgs($args, $includeAll); } ?> diff --git a/workflow/engine/classes/model/Users.php b/workflow/engine/classes/model/Users.php index eb92a080f..5cd394bb6 100644 --- a/workflow/engine/classes/model/Users.php +++ b/workflow/engine/classes/model/Users.php @@ -83,8 +83,11 @@ class Users extends BaseUsers try { $oRow = UsersPeer::retrieveByPK( $UsrUid ); if (! is_null( $oRow )) { + $this->fromArray( + $oRow->toArray( BasePeer::TYPE_FIELDNAME, true ), + BasePeer::TYPE_FIELDNAME + ); $aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME ); - $this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME ); $this->setNew( false ); return $aFields; } else { @@ -496,10 +499,14 @@ class Users extends BaseUsers * * @param string $keyType One of the class type constants TYPE_PHPNAME, * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM + * @param boolean $original If true return de original verion of fields. * @return an associative array containing the field names (as keys) and field values */ - public function toArray($keyType = BasePeer::TYPE_PHPNAME) + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $original = false) { + if ($original) { + return parent::toArray($keyType); + } $key = UsersPeer::translateFieldName( UsersPeer::USR_PASSWORD, BasePeer::TYPE_COLNAME, diff --git a/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php b/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php index 10604028a..9d1891927 100644 --- a/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php +++ b/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php @@ -6,6 +6,7 @@ use Archive_Tar; use enterprisePlugin; use Exception; use G; +use Illuminate\Support\Facades\Cache; use InputFilter; use Language; use PEAR; @@ -44,6 +45,7 @@ class PluginRegistry use PluginStructure; use Attributes; + const NAME_CACHE = SYS_SYS . __CLASS__; /** * Instance of de object PluginRegistry * @var PluginRegistry $instance @@ -72,7 +74,11 @@ class PluginRegistry public static function loadSingleton() { if (self::$instance === null) { - self::$instance = new PluginRegistry(); + if (is_null($object = Cache::get(self::NAME_CACHE))) { + $object = new PluginRegistry(); + Cache::put(self::NAME_CACHE, $object, config('app.cache_lifetime')); + } + self::$instance = $object; } return self::$instance; } @@ -180,6 +186,7 @@ class PluginRegistry $fieldPlugin = PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin); PluginsRegistry::update($fieldPlugin); } + Cache::pull(self::NAME_CACHE); } /** * Get the plugin details, by filename diff --git a/workflow/engine/src/ProcessMaker/Util/System.php b/workflow/engine/src/ProcessMaker/Util/System.php index f9863f741..124b08d77 100644 --- a/workflow/engine/src/ProcessMaker/Util/System.php +++ b/workflow/engine/src/ProcessMaker/Util/System.php @@ -35,6 +35,26 @@ class System } } + /** + * Returns workspace objects from an array of workspace names. + * + * @param array $args an array of workspace names + * @param bool $includeAll if true and no workspace is specified in args, + * returns all available workspaces + * @return array of workspace objects + */ + public static function getWorkspacesFromArgs($args, $includeAll = true) + { + $workspaces = array(); + foreach ($args as $arg) { + $workspaces[] = new \workspaceTools($arg); + } + if (empty($workspaces) && $includeAll) { + $workspaces = \System::listWorkspaces(); + } + return $workspaces; + } + /** * Flush the cache files for the specified workspace. *