Search in sources :

Example 1 with SubjectedObjectSelectorType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.SubjectedObjectSelectorType in project midpoint by Evolveum.

the class AbstractSecurityTest method test000Sanity.

@Test
public void test000Sanity() throws Exception {
    final String TEST_NAME = "test000Sanity";
    TestUtil.displayTestTile(this, TEST_NAME);
    assertLoggedInUser(USER_ADMINISTRATOR_USERNAME);
    // WHEN
    PrismObject<RoleType> roleSelf = getRole(ROLE_SELF_OID);
    // THEN
    display("Role self", roleSelf);
    List<AuthorizationType> authorizations = roleSelf.asObjectable().getAuthorization();
    assertEquals("Wrong number of authorizations", 2, authorizations.size());
    AuthorizationType authRead = findAutz(authorizations, ModelAuthorizationAction.READ.getUrl());
    assertEquals("Wrong action in authorization", ModelAuthorizationAction.READ.getUrl(), authRead.getAction().get(0));
    List<OwnedObjectSelectorType> objectSpecs = authRead.getObject();
    assertEquals("Wrong number of object specs in authorization", 1, objectSpecs.size());
    SubjectedObjectSelectorType objectSpec = objectSpecs.get(0);
    List<SpecialObjectSpecificationType> specials = objectSpec.getSpecial();
    assertEquals("Wrong number of specials in object specs in authorization", 1, specials.size());
    SpecialObjectSpecificationType special = specials.get(0);
    assertEquals("Wrong special in object specs in authorization", SpecialObjectSpecificationType.SELF, special);
}
Also used : SubjectedObjectSelectorType(com.evolveum.midpoint.xml.ns._public.common.common_3.SubjectedObjectSelectorType) OwnedObjectSelectorType(com.evolveum.midpoint.xml.ns._public.common.common_3.OwnedObjectSelectorType) RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) SpecialObjectSpecificationType(com.evolveum.midpoint.xml.ns._public.common.common_3.SpecialObjectSpecificationType) AuthorizationType(com.evolveum.midpoint.xml.ns._public.common.common_3.AuthorizationType) Test(org.testng.annotations.Test) AbstractInitializedModelIntegrationTest(com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)

Aggregations

AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)1 AuthorizationType (com.evolveum.midpoint.xml.ns._public.common.common_3.AuthorizationType)1 OwnedObjectSelectorType (com.evolveum.midpoint.xml.ns._public.common.common_3.OwnedObjectSelectorType)1 RoleType (com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType)1 SpecialObjectSpecificationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SpecialObjectSpecificationType)1 SubjectedObjectSelectorType (com.evolveum.midpoint.xml.ns._public.common.common_3.SubjectedObjectSelectorType)1 Test (org.testng.annotations.Test)1