This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git
commit 9b1f9bf2fd85d9f107d96fe260763ca7260c083b Author: Francesco Chicchiriccò <[email protected]> AuthorDate: Mon Sep 7 12:13:08 2020 +0200 Minor cleanup --- .../syncope/core/logic/UserRequestLogic.java | 40 ++++++++++++---------- .../reference/flowable/CreateARelationship.java | 3 +- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/ext/flowable/logic/src/main/java/org/apache/syncope/core/logic/UserRequestLogic.java b/ext/flowable/logic/src/main/java/org/apache/syncope/core/logic/UserRequestLogic.java index 65ed365..0bd38b5 100644 --- a/ext/flowable/logic/src/main/java/org/apache/syncope/core/logic/UserRequestLogic.java +++ b/ext/flowable/logic/src/main/java/org/apache/syncope/core/logic/UserRequestLogic.java @@ -73,7 +73,8 @@ public class UserRequestLogic extends AbstractTransactionalLogic<EntityTO> { @PreAuthorize("isAuthenticated()") @Transactional(readOnly = true) - public Pair<Integer, List<UserRequest>> list(final String userKey, + public Pair<Integer, List<UserRequest>> list( + final String userKey, final int page, final int size, final List<OrderByClause> orderByClauses) { @@ -100,8 +101,9 @@ public class UserRequestLogic extends AbstractTransactionalLogic<EntityTO> { final String bpmnProcess, final User user, final WorkflowTaskExecInput inputVariables) { + // check if BPMN process exists - bpmnProcessManager.exportProcess(bpmnProcess, BpmnProcessFormat.XML, new NullOutputStream()); + bpmnProcessManager.exportProcess(bpmnProcess, BpmnProcessFormat.XML, NullOutputStream.NULL_OUTPUT_STREAM); return userRequestHandler.start(bpmnProcess, user, inputVariables); } @@ -159,6 +161,23 @@ public class UserRequestLogic extends AbstractTransactionalLogic<EntityTO> { return form; } + private void evaluateKey(final String userKey) { + if (userKey == null) { + securityChecks(null, + FlowableEntitlement.USER_REQUEST_FORM_LIST, + "Listing forms not allowed"); + } else { + User user = userDAO.find(userKey); + if (user == null) { + throw new NotFoundException("User " + userKey); + } + + securityChecks(user.getUsername(), + FlowableEntitlement.USER_REQUEST_FORM_LIST, + "Listing forms for user" + user.getUsername() + " not allowed"); + } + } + @PreAuthorize("isAuthenticated()") public UserRequestForm getForm(final String userKey, final String taskId) { evaluateKey(userKey); @@ -220,21 +239,4 @@ public class UserRequestLogic extends AbstractTransactionalLogic<EntityTO> { throw new UnresolvedReferenceException(); } - - private void evaluateKey(final String userKey) { - if (userKey == null) { - securityChecks(null, - FlowableEntitlement.USER_REQUEST_FORM_LIST, - "Listing forms not allowed"); - } else { - User user = userDAO.find(userKey); - if (user == null) { - throw new NotFoundException("User " + userKey); - } - - securityChecks(user.getUsername(), - FlowableEntitlement.USER_REQUEST_FORM_LIST, - "Listing forms for user" + user.getUsername() + " not allowed"); - } - } } diff --git a/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/CreateARelationship.java b/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/CreateARelationship.java index f6f021f..1ca0940 100644 --- a/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/CreateARelationship.java +++ b/fit/core-reference/src/main/java-all/org/apache/syncope/fit/core/reference/flowable/CreateARelationship.java @@ -43,8 +43,7 @@ public class CreateARelationship extends FlowableServiceTask { @Override protected void doExecute(final DelegateExecution execution) { - User user = execution. - getVariable(FlowableRuntimeUtils.USER, User.class); + User user = execution.getVariable(FlowableRuntimeUtils.USER, User.class); Boolean approve = execution.getVariable("approve", Boolean.class); if (Boolean.TRUE.equals(approve)) {
