Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,9 @@ private <F extends FocusType> boolean evaluateExistenceMapping(
.implicitSourcePath(LEGAL_PROPERTY_NAME)
.implicitTargetPath(SHADOW_EXISTS_PROPERTY_NAME);

builder.defaultSource(new Source<>(getLegalIdi(projCtx), ExpressionConstants.VAR_LEGAL_QNAME));
ItemDeltaItem<PrismPropertyValue<Boolean>, PrismPropertyDefinition<Boolean>> legalIdi = getLegalIdi(projCtx);
builder.defaultSource(new Source<>(legalIdi, ExpressionConstants.VAR_LEGAL_QNAME));
builder.additionalSource(new Source<>(legalIdi, ExpressionConstants.VAR_INPUT_QNAME));
builder.additionalSource(new Source<>(getAssignedIdi(projCtx), ExpressionConstants.VAR_ASSIGNED_QNAME));
builder.additionalSource(new Source<>(getFocusExistsIdi(context.getFocusContext()), ExpressionConstants.VAR_FOCUS_EXISTS_QNAME));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ public class TestActivation extends AbstractInitializedModelIntegrationTest {
c -> c.extendSchemaPirate());
private static final DummyTestResource RESOURCE_DUMMY_FIXED_EXISTENCE = new DummyTestResource(TEST_DIR,
"resource-dummy-fixed-existence.xml", "8ba303ee-3f07-4163-aa46-508cbc496ff4", "fixed-existence");
private static final DummyTestResource RESOURCE_DUMMY_EXISTENCE_INPUT = new DummyTestResource(TEST_DIR,
"resource-dummy-existence-input.xml", "8ba303ee-3f07-4163-aa46-508cbc496ff5", "existence-input");

private static final String ACCOUNT_MANCOMB_DUMMY_USERNAME = "mancomb";
private static final Date ACCOUNT_MANCOMB_VALID_FROM_DATE = MiscUtil.asDate(2011, 2, 3, 4, 5, 6);
Expand Down Expand Up @@ -133,7 +135,8 @@ public void initSystem(Task initTask, OperationResult initResult)
RESOURCE_DUMMY_KHAKI,
RESOURCE_DUMMY_PRECREATE,
RESOURCE_DUMMY_FULL_VALIDITY,
RESOURCE_DUMMY_FIXED_EXISTENCE);
RESOURCE_DUMMY_FIXED_EXISTENCE,
RESOURCE_DUMMY_EXISTENCE_INPUT);

resourceDummyKhaki = modelService
.getObject(ResourceType.class, RESOURCE_DUMMY_KHAKI.oid, null, initTask, initResult)
Expand Down Expand Up @@ -3115,6 +3118,36 @@ public void test820FixedExistence() throws Exception {
.assertFullName(fullName);
}

/** Existence mapping should expose "input" as the same legality value as "legal". MID-10905. */
@Test
public void test830ExistenceInput() throws Exception {
var task = getTestTask();
var result = task.getResult();
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.FULL);
var userName = getTestNameShort();
var fullName = "Mr. " + userName;

given("a user with a single account exists");
var user = new UserType()
.name(userName)
.fullName(fullName)
.assignment(
RESOURCE_DUMMY_EXISTENCE_INPUT.assignmentWithConstructionOf(ACCOUNT, INTENT_DEFAULT));
addObject(user, task, result);

then("the existence mapping used input=true to create the account");
assertSuccess(result);
assertDummyAccountByUsername(RESOURCE_DUMMY_EXISTENCE_INPUT.name, userName)
.assertFullName(fullName);

when("the account is unassigned");
unassignAccountFromUser(user.getOid(), RESOURCE_DUMMY_EXISTENCE_INPUT.oid, INTENT_DEFAULT, task, result);

then("the existence mapping used input=false to delete the account");
assertSuccess(result);
assertNoDummyAccount(RESOURCE_DUMMY_EXISTENCE_INPUT.name, userName);
}

private void assertDummyActivationEnabledState(String userId, Boolean expectedEnabled) throws SchemaViolationException, ConflictException, InterruptedException {
assertDummyActivationEnabledState(null, userId, expectedEnabled);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2026 Evolveum and contributors
~
~ Licensed under the EUPL-1.2 or later.
-->

<resource oid="8ba303ee-3f07-4163-aa46-508cbc496ff5"
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">

<name>resource-dummy-existence-input</name>
<connectorRef type="c:ConnectorType">
<filter>
<q:and>
<q:equal>
<q:path>connectorType</q:path>
<q:value>com.evolveum.icf.dummy.connector.DummyConnector</q:value>
</q:equal>
<q:equal>
<q:path>connectorVersion</q:path>
<q:value>2.0</q:value>
</q:equal>
</q:and>
</filter>
</connectorRef>
<connectorConfiguration xmlns:icfi="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/com.evolveum.icf.dummy/com.evolveum.icf.dummy.connector.DummyConnector"
xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3">
<icfc:configurationProperties>
<icfi:instanceId>existence-input</icfi:instanceId>
</icfc:configurationProperties>
</connectorConfiguration>
<schemaHandling>
<objectType>
<kind>account</kind>
<intent>default</intent>
<displayName>Default Account</displayName>
<default>true</default>
<objectClass>ri:AccountObjectClass</objectClass>
<attribute>
<ref>icfs:name</ref>
<outbound>
<strength>strong</strength>
<source>
<path>name</path>
</source>
</outbound>
</attribute>
<attribute>
<ref>ri:fullname</ref>
<outbound>
<strength>strong</strength>
<source>
<path>fullName</path>
</source>
</outbound>
</attribute>
<activation>
<existence>
<outbound>
<expression>
<script>
<code>
if (input != legal) {
throw new IllegalStateException('input and legal differ')
}
input
</code>
</script>
</expression>
</outbound>
</existence>
</activation>
</objectType>
</schemaHandling>
</resource>
1 change: 1 addition & 0 deletions release-notes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Overall, midPoint 4.10 opens up the world of identity management and governance
* Delineation suggestions: filter parsing broken after recent GUI change. See bug:MID-11175[]
* Fixed work item search by name causing repository mapping error. See bug:MID-8834[]
* Fixed translation of archetype display labels in assignment picker and summary panel. See bug:MID-11177[]
* Fixed missing input variable in resource activation existence mappings. See bug:MID-10905[]

=== Releases Of Other Components

Expand Down
Loading