未验证 提交 851d55be 编写于 作者: G Giovanni Fertuso 提交者: GitHub

[AAE-9212] Allow APPLICATION_MANAGER access Processes and tasks admin services (#3974)

上级 bdbbd3b8
...@@ -53,7 +53,7 @@ import org.springframework.context.ApplicationEventPublisher; ...@@ -53,7 +53,7 @@ import org.springframework.context.ApplicationEventPublisher;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@PreAuthorize("hasRole('ACTIVITI_ADMIN')") @PreAuthorize("hasAnyRole('ACTIVITI_ADMIN','APPLICATION_MANAGER')")
public class ProcessAdminRuntimeImpl implements ProcessAdminRuntime { public class ProcessAdminRuntimeImpl implements ProcessAdminRuntime {
private final RepositoryService repositoryService; private final RepositoryService repositoryService;
......
...@@ -47,7 +47,7 @@ import org.activiti.runtime.api.model.impl.APIVariableInstanceConverter; ...@@ -47,7 +47,7 @@ import org.activiti.runtime.api.model.impl.APIVariableInstanceConverter;
import org.activiti.runtime.api.query.impl.PageImpl; import org.activiti.runtime.api.query.impl.PageImpl;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
@PreAuthorize("hasRole('ACTIVITI_ADMIN')") @PreAuthorize("hasAnyRole('ACTIVITI_ADMIN','APPLICATION_MANAGER')")
public class TaskAdminRuntimeImpl implements TaskAdminRuntime { public class TaskAdminRuntimeImpl implements TaskAdminRuntime {
private final TaskService taskService; private final TaskService taskService;
......
...@@ -120,6 +120,13 @@ public class RuntimeTestConfiguration { ...@@ -120,6 +120,13 @@ public class RuntimeTestConfiguration {
"password", "password",
deanAuthorities)); deanAuthorities));
List<GrantedAuthority> managerAuthorities = new ArrayList<>();
managerAuthorities.add(new SimpleGrantedAuthority("ROLE_APPLICATION_MANAGER"));
extendedInMemoryUserDetailsManager.createUser(new User("manager",
"password",
managerAuthorities));
return extendedInMemoryUserDetailsManager; return extendedInMemoryUserDetailsManager;
} }
......
...@@ -994,4 +994,14 @@ public class ProcessRuntimeIT { ...@@ -994,4 +994,14 @@ public class ProcessRuntimeIT {
assertThat(processInstancePage.getContent()).hasSize(1); assertThat(processInstancePage.getContent()).hasSize(1);
assertThat(processInstancePage.getContent().get(0).getId()).isEqualTo(processInstance.getId()); assertThat(processInstancePage.getContent().get(0).getId()).isEqualTo(processInstance.getId());
} }
@Test
public void should_returnProcessesWhenUserIsApplicationManager() {
securityUtil.logInAs("manager");
Page<ProcessInstance> processInstancePage = processAdminRuntime.processInstances(Pageable.of(0,
50));
assertThat(processInstancePage).isNotNull();
}
} }
...@@ -86,4 +86,14 @@ public class TaskRuntimeUnAuthorizedTest { ...@@ -86,4 +86,14 @@ public class TaskRuntimeUnAuthorizedTest {
.isInstanceOf(NotFoundException.class); .isInstanceOf(NotFoundException.class);
} }
@Test
public void shouldGetTasksAsApplicationManager() {
securityUtil.logInAs("manager");
Page<Task> tasks = taskAdminRuntime.tasks(Pageable.of(0,
50));
assertThat(tasks.getContent()).hasSize(0);
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册