Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'runAsRef' and task filters to scripting rules
1) Scripting action can be run under different user (runAsRef). This is implemented using new experimental RunAsRunner class. 2) Task template reference can now contain a filter. It is resolved using new experimental ReferenceResolver (assignment evaluator was refactored to use it as well). 3) Various expressions (including those in filters) are now evaluated for positive values only. (Evaluating old state was useless.) A part of MID-5967 implementation.
- Loading branch information
Showing
30 changed files
with
635 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
infra/util/src/main/java/com/evolveum/midpoint/util/CheckedRunnable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright (c) 2010-2018 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
package com.evolveum.midpoint.util; | ||
|
||
import java.io.Serializable; | ||
|
||
import com.evolveum.midpoint.util.annotation.Experimental; | ||
import com.evolveum.midpoint.util.exception.CommonException; | ||
|
||
/** | ||
* Almost the same as Runnable but this one can throw CommonException and is serializable. | ||
*/ | ||
@Experimental | ||
@FunctionalInterface | ||
public interface CheckedRunnable extends Serializable { | ||
void run() throws CommonException; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
model/model-api/src/main/java/com/evolveum/midpoint/model/api/util/ReferenceResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) 2020 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.model.api.util; | ||
|
||
import com.evolveum.midpoint.prism.PrismObject; | ||
import com.evolveum.midpoint.prism.query.ObjectFilter; | ||
import com.evolveum.midpoint.schema.GetOperationOptions; | ||
import com.evolveum.midpoint.schema.SelectorOptions; | ||
import com.evolveum.midpoint.schema.result.OperationResult; | ||
import com.evolveum.midpoint.task.api.Task; | ||
import com.evolveum.midpoint.util.annotation.Experimental; | ||
import com.evolveum.midpoint.util.exception.*; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.io.Serializable; | ||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
/** | ||
Resolves references in intelligent way: taking filters (and embedded expressions) into account. | ||
* | ||
* Different from ObjectResolver: | ||
* 1) more focused (resolving references only, no additional methods) | ||
* 2) advanced functionality (filters with expressions) | ||
*/ | ||
@Experimental | ||
public interface ReferenceResolver { | ||
|
||
enum Source { | ||
REPOSITORY, MODEL | ||
} | ||
|
||
@FunctionalInterface | ||
interface FilterEvaluator extends Serializable { | ||
ObjectFilter evaluate(ObjectFilter rawFilter, OperationResult result) throws SchemaException, | ||
ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, | ||
ConfigurationException, SecurityViolationException; | ||
} | ||
|
||
List<PrismObject<? extends ObjectType>> resolve(@NotNull ObjectReferenceType reference, | ||
Collection<SelectorOptions<GetOperationOptions>> options, @NotNull Source source, | ||
FilterEvaluator filterEvaluator, Task task, OperationResult result) throws SchemaException, | ||
ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, | ||
ConfigurationException, SecurityViolationException; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.