Search in sources :

Example 6 with AttributePermission

use of org.craftercms.profile.api.AttributePermission in project profile by craftercms.

the class TenantServiceIT method getSubscriptionsAttributeDefinition.

private AttributeDefinition getSubscriptionsAttributeDefinition() {
    AttributePermission permission1 = new AttributePermission(ADMIN_CONSOLE_APPLICATION);
    permission1.allow(AttributePermission.ANY_ACTION);
    AttributePermission permission2 = new AttributePermission(CRAFTER_SOCIAL_APPLICATION);
    permission2.allow(AttributePermission.ANY_ACTION);
    AttributeDefinition definition = new AttributeDefinition();
    definition.setName(SUBSCRIPTIONS_ATTRIBUTE_NAME);
    definition.addPermission(permission1);
    definition.addPermission(permission2);
    return definition;
}
Also used : AttributePermission(org.craftercms.profile.api.AttributePermission) AttributeDefinition(org.craftercms.profile.api.AttributeDefinition)

Example 7 with AttributePermission

use of org.craftercms.profile.api.AttributePermission in project profile by craftercms.

the class TenantServiceIT method getLastNameAttributeDefinition.

private AttributeDefinition getLastNameAttributeDefinition() {
    AttributePermission permission = new AttributePermission(AttributePermission.ANY_APPLICATION);
    permission.allow(AttributePermission.ANY_ACTION);
    AttributeDefinition definition = new AttributeDefinition();
    definition.setName(LAST_NAME_ATTRIBUTE_NAME);
    definition.addPermission(permission);
    return definition;
}
Also used : AttributePermission(org.craftercms.profile.api.AttributePermission) AttributeDefinition(org.craftercms.profile.api.AttributeDefinition)

Example 8 with AttributePermission

use of org.craftercms.profile.api.AttributePermission in project profile by craftercms.

the class TenantServiceIT method getFirstNameAttributeDefinition.

private AttributeDefinition getFirstNameAttributeDefinition() {
    AttributePermission permission = new AttributePermission(AttributePermission.ANY_APPLICATION);
    permission.allow(AttributePermission.ANY_ACTION);
    AttributeDefinition definition = new AttributeDefinition();
    definition.setName(FIRST_NAME_ATTRIBUTE_NAME);
    definition.addPermission(permission);
    return definition;
}
Also used : AttributePermission(org.craftercms.profile.api.AttributePermission) AttributeDefinition(org.craftercms.profile.api.AttributeDefinition)

Example 9 with AttributePermission

use of org.craftercms.profile.api.AttributePermission in project profile by craftercms.

the class TenantServiceIT method assertEqualAttributeDefinitions.

private void assertEqualAttributeDefinitions(AttributeDefinition expected, AttributeDefinition actual) {
    List<AttributePermission> expectedPermissions = expected.getPermissions();
    List<AttributePermission> actualPermissions = actual.getPermissions();
    assertEquals(expected.getName(), actual.getName());
    assertEquals(expected.getMetadata(), actual.getMetadata());
    assertNotNull(actualPermissions);
    assertEquals(expectedPermissions.size(), actualPermissions.size());
    for (int i = 0; i < expectedPermissions.size(); i++) {
        AttributePermission expectedPermission = expectedPermissions.get(i);
        AttributePermission actualPermission = actualPermissions.get(i);
        assertEquals(expectedPermission.getApplication(), actualPermission.getApplication());
        assertEquals(expectedPermission.getAllowedActions(), actualPermission.getAllowedActions());
    }
}
Also used : AttributePermission(org.craftercms.profile.api.AttributePermission)

Example 10 with AttributePermission

use of org.craftercms.profile.api.AttributePermission in project profile by craftercms.

the class TenantServiceImplTest method getAttribute1Definition.

private AttributeDefinition getAttribute1Definition() {
    AttributePermission permission = new AttributePermission();
    permission.allow(AttributePermission.ANY_ACTION);
    AttributeDefinition def = new AttributeDefinition();
    def.setName(ATTRIB1_NAME);
    def.setMetadata(Collections.<String, Object>singletonMap(LABEL_KEY, ATTRIB1_LABEL));
    def.addPermission(permission);
    return def;
}
Also used : AttributePermission(org.craftercms.profile.api.AttributePermission) AttributeDefinition(org.craftercms.profile.api.AttributeDefinition)

Aggregations

AttributePermission (org.craftercms.profile.api.AttributePermission)10 AttributeDefinition (org.craftercms.profile.api.AttributeDefinition)7