// submit task form (standalone task) //////////////////////////////// public virtual void testStandaloneTaskSubmitTaskFormWithoutAuthorization() { // given string taskId = "myTask"; createTask(taskId); try { // when formService.submitTaskForm(taskId, null); fail("Exception expected: It should not possible to submit a task form"); } catch (AuthorizationException e) { // then string message = e.Message; assertTextPresent(userId, message); assertTextPresent(UPDATE.Name, message); assertTextPresent(taskId, message); assertTextPresent(TASK.resourceName(), message); } deleteTask(taskId, true); }
// submit task form (process task) //////////////////////////////// public virtual void testProcessTaskSubmitTaskFormWithoutAuthorization() { // given startProcessInstanceByKey(FORM_PROCESS_KEY); string taskId = selectSingleTask().Id; try { // when formService.submitTaskForm(taskId, null); fail("Exception expected: It should not possible to submit a task form"); } catch (AuthorizationException e) { // then string message = e.Message; assertTextPresent(userId, message); assertTextPresent(UPDATE.Name, message); assertTextPresent(taskId, message); assertTextPresent(TASK.resourceName(), message); assertTextPresent(UPDATE_TASK.Name, message); assertTextPresent(FORM_PROCESS_KEY, message); assertTextPresent(PROCESS_DEFINITION.resourceName(), message); } }
// get task form variables (process task) ///////////////////////////////// public virtual void testProcessTaskGetTaskFormVariablesWithoutAuthorization() { // given startProcessInstanceByKey(RENDERED_FORM_PROCESS_KEY); string taskId = selectSingleTask().Id; try { // when formService.getTaskFormVariables(taskId); fail("Exception expected: It should not possible to get task form variables"); } catch (AuthorizationException e) { // then string message = e.Message; assertTextPresent(userId, message); assertTextPresent(READ.Name, message); assertTextPresent(taskId, message); assertTextPresent(TASK.resourceName(), message); assertTextPresent(READ_TASK.Name, message); assertTextPresent(RENDERED_FORM_PROCESS_KEY, message); assertTextPresent(PROCESS_DEFINITION.resourceName(), message); } // given (2) processEngineConfiguration.EnforceSpecificVariablePermission = true; try { // when (2) formService.getTaskFormVariables(taskId); fail("Exception expected: It should not possible to get task form variables"); } catch (AuthorizationException e) { // then (2) string message = e.Message; assertTextPresent(userId, message); assertTextPresent(READ_VARIABLE.Name, message); assertTextPresent(taskId, message); assertTextPresent(TASK.resourceName(), message); assertTextPresent(READ_TASK_VARIABLE.Name, message); assertTextPresent(RENDERED_FORM_PROCESS_KEY, message); assertTextPresent(PROCESS_DEFINITION.resourceName(), message); } }
// get rendered task form (process task) ///////////////////////////////// public virtual void testProcessTaskGetRenderedTaskFormWithoutAuthorization() { // given startProcessInstanceByKey(RENDERED_FORM_PROCESS_KEY); string taskId = selectSingleTask().Id; try { // when formService.getRenderedTaskForm(taskId); fail("Exception expected: It should not possible to get rendered task form"); } catch (AuthorizationException e) { // then string message = e.Message; assertTextPresent(userId, message); assertTextPresent(READ.Name, message); assertTextPresent(taskId, message); assertTextPresent(TASK.resourceName(), message); assertTextPresent(READ_TASK.Name, message); assertTextPresent(RENDERED_FORM_PROCESS_KEY, message); assertTextPresent(PROCESS_DEFINITION.resourceName(), message); } // given (2) setReadVariableAsDefaultReadVariablePermission(); try { // when (2) formService.getRenderedTaskForm(taskId); fail("Exception expected: It should not possible to get rendered task form"); } catch (AuthorizationException e) { // then (2) string message = e.Message; assertTextPresent(userId, message); assertTextPresent(READ_VARIABLE.Name, message); assertTextPresent(taskId, message); assertTextPresent(TASK.resourceName(), message); assertTextPresent(READ_TASK_VARIABLE.Name, message); assertTextPresent(RENDERED_FORM_PROCESS_KEY, message); assertTextPresent(PROCESS_DEFINITION.resourceName(), message); } }
// get rendered task form (standalone task) ////////////////// public virtual void testStandaloneTaskGetTaskRenderedFormWithoutAuthorization() { // given string taskId = "myTask"; createTask(taskId); try { // when formService.getRenderedTaskForm(taskId); fail("Exception expected: It should not possible to get rendered task form"); } catch (AuthorizationException e) { // then string message = e.Message; assertTextPresent(userId, message); assertTextPresent(READ.Name, message); assertTextPresent(taskId, message); assertTextPresent(TASK.resourceName(), message); } // given (2) setReadVariableAsDefaultReadVariablePermission(); try { // when (2) formService.getRenderedTaskForm(taskId); fail("Exception expected: It should not possible to get rendered task form"); } catch (AuthorizationException e) { // then (2) string message = e.Message; assertTextPresent(userId, message); assertTextPresent(READ_VARIABLE.Name, message); assertTextPresent(taskId, message); assertTextPresent(TASK.resourceName(), message); } deleteTask(taskId, true); }
public virtual void testGetDeployedTaskFormWithoutAuthorization() { // given startProcessInstanceByKey(FORM_PROCESS_KEY); string taskId = selectSingleTask().Id; try { // when formService.getDeployedTaskForm(taskId); fail("Exception expected: It should not possible to get a deployed task form"); } catch (AuthorizationException e) { // then string message = e.Message; assertTextPresent(userId, message); assertTextPresent(READ.Name, message); assertTextPresent(FORM_PROCESS_KEY, message); assertTextPresent(TASK.resourceName(), message); } }