use of com.evolveum.midpoint.xml.ns._public.common.common_3.PolicyRuleType in project midpoint by Evolveum.
the class TestParseMetarole method assertMetaroleJaxb.
private void assertMetaroleJaxb(RoleType roleType, boolean isObject) throws SchemaException {
assertEquals("Wrong name", PrismTestUtil.createPolyStringType("Generic Metarole"), roleType.getName());
boolean found = false;
for (AssignmentType inducement : roleType.getInducement()) {
if (inducement.getId() == 2L) {
found = true;
PolicyRuleType rule = inducement.getPolicyRule();
assertNotNull("No constraints", rule.getPolicyConstraints());
assertEquals("Wrong # of assignment constraints", 1, rule.getPolicyConstraints().getAssignment().size());
assertTrue("Wrong (not empty) assignment constraints", rule.getPolicyConstraints().getAssignment().get(0).asPrismContainerValue().isEmpty());
break;
}
}
assertTrue("Assignment number 2 was not found", found);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.PolicyRuleType in project midpoint by Evolveum.
the class TestSecurityBasic method test273AutzJackRedyAssignmentExceptionRules.
/**
* Check that the #assign authorization does not allow assignment that contains
* policyException or policyRule.
*/
@Test
public void test273AutzJackRedyAssignmentExceptionRules() throws Exception {
final String TEST_NAME = "test273AutzJackRedyAssignmentExceptionRules";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
cleanupAutzTest(USER_JACK_OID);
assignRole(USER_JACK_OID, ROLE_ASSIGN_ANY_ROLES_OID);
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.RELATIVE);
login(USER_JACK_USERNAME);
// WHEN
TestUtil.displayWhen(TEST_NAME);
assertReadAllow(NUMBER_OF_ALL_USERS + 1);
assertAddDeny();
assertModifyDeny();
assertDeleteDeny();
PrismObject<UserType> user = getUser(USER_JACK_OID);
assertAssignments(user, 2);
assertAssignedRole(user, ROLE_ASSIGN_ANY_ROLES_OID);
assertDeny("assign application role to jack", (task, result) -> assignRole(USER_JACK_OID, ROLE_APPLICATION_1_OID, null, assignment -> {
PolicyExceptionType policyException = new PolicyExceptionType();
policyException.setRuleName("whatever");
assignment.getPolicyException().add(policyException);
}, task, result));
user = getUser(USER_JACK_OID);
assertAssignments(user, 2);
assertDeny("assign application role to jack", (task, result) -> assignRole(USER_JACK_OID, ROLE_BUSINESS_1_OID, null, assignment -> {
PolicyRuleType policyRule = new PolicyRuleType();
policyRule.setName("whatever");
assignment.setPolicyRule(policyRule);
}, task, result));
user = getUser(USER_JACK_OID);
assertAssignments(user, 2);
assertGlobalStateUntouched();
}
Aggregations