Merge branch '3.0.1-GA' of bitbucket.org:colosa/processmaker into 3.0.1-GA

This commit is contained in:
Ronald Quenta
2015-08-12 09:57:04 -04:00
5 changed files with 223 additions and 84 deletions

View File

@@ -669,13 +669,10 @@ function run_check_workspace_disabled_code($args, $opts)
function migrate_new_cases_lists($command, $args) {
$workspaces = get_workspaces_from_args($args);
$checkOnly = (strcmp($command, "migrate") == 0);
foreach ($workspaces as $workspace) {
if ($checkOnly){
print_r("Checking database in ".pakeColor::colorize($workspace->name, "INFO")."\n");
} else {
print_r("Upgrading database in ".pakeColor::colorize($workspace->name, "INFO")."\n");
}
print_r("Upgrading database in " . pakeColor::colorize($workspace->name, "INFO") . "\n");
try {
$ws = $workspace->name;
$sContent = file_get_contents (PATH_DB . $ws . PATH_SEP . 'db.php');
@@ -684,21 +681,16 @@ function migrate_new_cases_lists($command, $args) {
} else {
$workspace->onedb = true;
}
//check if is the tables List are empty
$changes = $workspace->listFirstExecution('check');
if ($workspace->onedb && $changes != true) {
$workspace->migrateList($workspace->name);
}
if ($changes) {
if ($checkOnly) {
echo "-> List tables are done\n";
if ($workspace->onedb) {
$workspace->migrateList($workspace->name, true);
}
} else {
echo "> List tables are done\n";
}
} catch (Exception $e) {
echo "> Error: ".CLI::error($e->getMessage()) . "\n";
}
}
}
/*----------------------------------********---------------------------------*/

File diff suppressed because it is too large Load Diff

View File

@@ -1417,7 +1417,7 @@ class AppCacheView extends BaseAppCacheView
}
if (!$found) {
$filenameSql = $this->pathToAppCacheFiles . '/triggerAppDelegationUpdate.sql';
$filenameSql = $this->pathToAppCacheFiles . "triggerAppDelegationUpdate.sql";
if (!file_exists($filenameSql)) {
throw (new Exception("file triggerAppDelegationUpdate.sql does not exist "));
@@ -1462,7 +1462,7 @@ class AppCacheView extends BaseAppCacheView
}
if (!$found) {
$filenameSql = $this->pathToAppCacheFiles . '/triggerApplicationUpdate.sql';
$filenameSql = $this->pathToAppCacheFiles . "triggerApplicationUpdate.sql";
if (!file_exists($filenameSql)) {
throw (new Exception("file triggerApplicationUpdate.sql doesn't exist "));
@@ -1507,7 +1507,7 @@ class AppCacheView extends BaseAppCacheView
}
if (!$found) {
$filenameSql = $this->pathToAppCacheFiles . '/triggerApplicationDelete.sql';
$filenameSql = $this->pathToAppCacheFiles . "triggerApplicationDelete.sql";
if (!file_exists($filenameSql)) {
throw (new Exception("file triggerApplicationDelete.sql doesn't exist"));
@@ -1545,7 +1545,7 @@ class AppCacheView extends BaseAppCacheView
}
if (!$found) {
$filenameSql = $this->pathToAppCacheFiles . PATH_SEP . "triggerContentUpdate.sql";
$filenameSql = $this->pathToAppCacheFiles . "triggerContentUpdate.sql";
if (!file_exists($filenameSql)) {
throw (new Exception("file triggerContentUpdate.sql doesn't exist"));
@@ -1621,7 +1621,7 @@ class AppCacheView extends BaseAppCacheView
$triggers = array();
foreach ($triggerFiles as $triggerFile) {
$trigger = file_get_contents("{$this->pathToAppCacheFiles}/$triggerFile");
$trigger = file_get_contents($this->pathToAppCacheFiles . $triggerFile);
if ($trigger === false) {
throw new Exception("Could not read trigger contents in $triggerFile");

View File

@@ -634,6 +634,29 @@ class Group
}
}
/**
* return permissions of user
*/
public function loadUserRolePermission ($sSystem, $sUser)
{
require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "UsersRoles.php");
require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Systems.php");
require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "RbacUsers.php");
require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "RolesPeer.php");
$this->sSystem = $sSystem;
$this->usersRolesObj = new \UsersRoles();
$this->systemObj = new \Systems();
$fieldsSystem = $this->systemObj->loadByCode( $sSystem );
$fieldsRoles = $this->usersRolesObj->getRolesBySystem( $fieldsSystem['SYS_UID'], $sUser );
$fieldsPermissions = $this->usersRolesObj->getAllPermissions( $fieldsRoles['ROL_UID'], $sUser );
$this->userObj = new \RbacUsers();
$this->aUserInfo['USER_INFO'] = $this->userObj->load( $sUser );
$this->aUserInfo[$sSystem]['SYS_UID'] = $fieldsSystem['SYS_UID'];
$this->aUserInfo[$sSystem]['ROLE'] = $fieldsRoles;
$this->aUserInfo[$sSystem]['PERMISSIONS'] = $fieldsPermissions;
return $fieldsPermissions;
}
/**
* Get all Users of a Group
*
@@ -666,6 +689,11 @@ class Group
//SQL
switch ($option) {
case "SUPERVISOR":
$flagPermission = true;
//Criteria for Supervisor
$criteria = $this->getUserCriteria($groupUid, $arrayFilterData);
break;
case "USERS":
//Criteria
$criteria = $this->getUserCriteria($groupUid, $arrayFilterData);
@@ -720,12 +748,30 @@ class Group
$rsCriteria = \UsersPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
if (isset($flagPermission) && $flagPermission){
\G::LoadSystem('rbac');
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$aPermissions = $this->loadUserRolePermission("PROCESSMAKER", $row['USR_UID']);
$bInclude = false;
$arrayUser[] = $this->getUserDataFromRecord($row);
foreach ($aPermissions as $aPermission) {
if ($aPermission['PER_CODE'] == 'PM_SUPERVISOR') {
$bInclude = true;
}
}
if ($bInclude) {
$arrayUser[] = $this->getUserDataFromRecord($row);
}
}
} else {
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$arrayUser[] = $this->getUserDataFromRecord($row);
}
}
//Return
return $arrayUser;
} catch (\Exception $e) {

View File

@@ -142,5 +142,24 @@ class Group extends Api
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url GET /:grp_uid/supervisor-users
*
* @param string $grp_uid {@min 32}{@max 32}
*/
public function doGetSupervisorUsers($grp_uid, $filter = null, $start = null, $limit = null)
{
try {
$group = new \ProcessMaker\BusinessModel\Group();
$group->setFormatFieldNameInUppercase(false);
$response = $group->getUsers("SUPERVISOR", $grp_uid, array("filter" => $filter), null, null, $start, $limit);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}