This commit is contained in:
Roly Rudy Gutierrez Pinto
2017-10-19 11:44:31 -04:00
parent 3b6e2416ef
commit 11f01b8453
3 changed files with 22 additions and 41 deletions

View File

@@ -1747,6 +1747,12 @@ msgstr "Databases Source List"
msgid "Changes saved"
msgstr "Changes saved"
# TRANSLATION
# LABEL/ID_SELECT_USER_OR_GROUP
#: LABEL/ID_SELECT_USER_OR_GROUP
msgid "Please select the name of a user or a group in the Group or User field"
msgstr "Please select the name of a user or a group in the Group or User field"
# TRANSLATION
# LABEL/ID_EMAILS
#: LABEL/ID_EMAILS
@@ -27869,12 +27875,6 @@ msgstr "NOT IMPORTED"
msgid "CANNOT IMPORT"
msgstr "CANNOT IMPORT"
# TRANSLATION
# LABEL/ID_SELECT_USER_OR_GROUP
#: LABEL/ID_SELECT_USER_OR_GROUP
msgid "Please select the name of a user or a group in the Group or User field"
msgstr "Please select the name of a user or a group in the Group or User field"
# additionalTables/additionalTablesData.xml?ADD_TAB_NAME
# additionalTables/additionalTablesData.xml
#: text - ADD_TAB_NAME

View File

@@ -224,6 +224,9 @@ class ProcessPermissions
if ($opUid != '') {
$opUid = $this->validateOpUid($opUid);
}
if (empty($data['USR_UID']) || $data['USR_UID'] === "null") {
throw (new \Exception(\G::LoadTranslation("ID_SELECT_USER_OR_GROUP")));
}
if ($data['OP_USER_RELATION'] == "1") {
$this->validateUsrUid($data['USR_UID']);
} else {
@@ -381,7 +384,7 @@ class ProcessPermissions
{
$usr_uid = trim($usr_uid);
if ($usr_uid == '') {
throw (new \Exception(\G::LoadTranslation("ID_SELECT_USER_OR_GROUP")));
throw (new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array('usr_uid',''))));
}
$oUsers = new \Users();
if (!($oUsers->userExists($usr_uid))) {
@@ -403,7 +406,7 @@ class ProcessPermissions
{
$grp_uid = trim($grp_uid);
if ($grp_uid == '') {
throw (new \Exception(\G::LoadTranslation("ID_SELECT_USER_OR_GROUP")));
throw (new \Exception(\G::LoadTranslation("ID_GROUP_NOT_EXIST", array('grp_uid',''))));
}
$oGroup = new \Groupwf();
if (!($oGroup->GroupwfExists($grp_uid))) {

View File

@@ -58,44 +58,22 @@ class ProcessPermissions extends Api
}
/**
* Creates a new Process Permission for a project.
*
* @url POST /:prj_uid/process-permission/
* @status 201
*
* @param string $prj_uid {@min 1} {@max 32}
* @param array $request_data
*
* @param string $usr_uid {@from body} {@min 1} {@max 32}
* @param string $op_user_relation {@from body} {@choice 1,2}
* @param string $op_case_status {@from body} {@choice ALL,DRAFT,TO_DO,PAUSED,COMPLETED}
* @param string $op_participate {@from body} {@choice 0,1}
* @param string $op_obj_type {@from body} {@choice ANY,DYNAFORM,ATTACHMENT,INPUT,OUTPUT,CASES_NOTES,MSGS_HISTORY,SUMMARY_FORM}
* @param string $op_action {@from body} {@choice VIEW,BLOCK,DELETE,RESEND}
* @param string $tas_uid {@from body}
* @param string $op_task_source {@from body}
* @param string $dynaforms {@from body}
* @param string $inputs {@from body}
* @param string $outputs {@from body}
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return array
*
* @url POST /:prj_uid/process-permission/
* @status 201
* @throws RestException
*
* @access protected
* @class AccessControl {@permission PM_FACTORY}
*/
public function doPostProcessPermission(
$prj_uid,
$request_data,
$usr_uid,
$op_user_relation,
$op_case_status,
$op_participate,
$op_obj_type,
$op_action,
$tas_uid = '',
$op_task_source = '',
$dynaforms = '',
$inputs = '',
$outputs = ''
) {
public function doPostProcessPermission($prj_uid, $request_data)
{
try {
$hiddenFields = array('task_target', 'group_user', 'task_source',
'object_type', 'object', 'participated', 'action'