mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
PRODSEC-6261 - Add the missing Object Level Authorization call (#1160)
* PRODSEC-6261 Add 'shouldNotGetProcessesByNotInvolvedUser' test * PRODSEC-6261 Add user validation to 'getProcess' method * PRODSEC-6261 Add TestRail annotation minor fix
This commit is contained in:
@@ -16,7 +16,7 @@ import org.testng.annotations.Test;
|
|||||||
*/
|
*/
|
||||||
public class GetProcessSanityTests extends RestTest
|
public class GetProcessSanityTests extends RestTest
|
||||||
{
|
{
|
||||||
private UserModel userWhoStartsProcess, assignee;
|
private UserModel userWhoStartsProcess, assignee, user;
|
||||||
private RestProcessModel addedProcess, process;
|
private RestProcessModel addedProcess, process;
|
||||||
|
|
||||||
@BeforeClass(alwaysRun = true)
|
@BeforeClass(alwaysRun = true)
|
||||||
@@ -24,6 +24,7 @@ public class GetProcessSanityTests extends RestTest
|
|||||||
{
|
{
|
||||||
userWhoStartsProcess = dataUser.createRandomTestUser();
|
userWhoStartsProcess = dataUser.createRandomTestUser();
|
||||||
assignee = dataUser.createRandomTestUser();
|
assignee = dataUser.createRandomTestUser();
|
||||||
|
user = dataUser.createRandomTestUser();
|
||||||
addedProcess = restClient.authenticateUser(userWhoStartsProcess).withWorkflowAPI().addProcess("activitiAdhoc", assignee, false, CMISUtil.Priority.High);
|
addedProcess = restClient.authenticateUser(userWhoStartsProcess).withWorkflowAPI().addProcess("activitiAdhoc", assignee, false, CMISUtil.Priority.High);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,4 +60,13 @@ public class GetProcessSanityTests extends RestTest
|
|||||||
process.assertThat().field("id").is(addedProcess.getId())
|
process.assertThat().field("id").is(addedProcess.getId())
|
||||||
.and().field("startUserId").is(addedProcess.getStartUserId());
|
.and().field("startUserId").is(addedProcess.getStartUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestRail(section = { TestGroup.REST_API, TestGroup.PROCESSES }, executionType = ExecutionType.SANITY,
|
||||||
|
description = "Verify User that is not involved in a process cannot get that process using REST API and status code is FORBIDDEN (403)")
|
||||||
|
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.PROCESSES, TestGroup.SANITY })
|
||||||
|
public void shouldNotGetProcessesByNotInvolvedUser() throws Exception
|
||||||
|
{
|
||||||
|
process = restClient.authenticateUser(user).withWorkflowAPI().usingProcess(addedProcess).getProcess();
|
||||||
|
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -512,6 +512,8 @@ public class ProcessesImpl extends WorkflowRestImpl implements Processes
|
|||||||
throw new InvalidArgumentException("processId is required to get the process info");
|
throw new InvalidArgumentException("processId is required to get the process info");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validateIfUserAllowedToWorkWithProcess(processId);
|
||||||
|
|
||||||
HistoricProcessInstance processInstance = activitiProcessEngine
|
HistoricProcessInstance processInstance = activitiProcessEngine
|
||||||
.getHistoryService()
|
.getHistoryService()
|
||||||
.createHistoricProcessInstanceQuery()
|
.createHistoricProcessInstanceQuery()
|
||||||
|
Reference in New Issue
Block a user