use of org.craftercms.profile.api.AttributeDefinition in project profile by craftercms.
the class TenantServiceIT method assertEqualAttributeDefinitions.
private void assertEqualAttributeDefinitions(List<AttributeDefinition> expected, List<AttributeDefinition> actual) {
assertNotNull(expected);
assertEquals(expected.size(), actual.size());
Iterator<AttributeDefinition> expectedIter = expected.iterator();
Iterator<AttributeDefinition> actualIter = actual.iterator();
while (expectedIter.hasNext()) {
AttributeDefinition expectedDefinition = expectedIter.next();
AttributeDefinition actualDefinition = actualIter.next();
assertEqualAttributeDefinitions(expectedDefinition, actualDefinition);
}
}
use of org.craftercms.profile.api.AttributeDefinition 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;
}
use of org.craftercms.profile.api.AttributeDefinition 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;
}
use of org.craftercms.profile.api.AttributeDefinition in project profile by craftercms.
the class TenantServiceIT method testAddAttributeDefinitions.
@Test
public void testAddAttributeDefinitions() throws Exception {
tenantService.createTenant(getCorporateTenant());
try {
List<AttributeDefinition> definitions = Arrays.asList(getGenderAttributeDefinition());
Tenant tenant = tenantService.addAttributeDefinitions(CORPORATE_TENANT_NAME, definitions);
List<AttributeDefinition> expected = getAttributeDefinitions();
expected.addAll(definitions);
assertNotNull(tenant);
assertNotNull(tenant.getAttributeDefinitions());
assertEquals(4, tenant.getAttributeDefinitions().size());
assertEquals(expected, tenant.getAttributeDefinitions());
} finally {
tenantService.deleteTenant(CORPORATE_TENANT_NAME);
}
}
use of org.craftercms.profile.api.AttributeDefinition 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;
}
Aggregations