use of org.craftercms.profile.exceptions.AttributeNotDefinedException in project profile by craftercms.
the class ProfileServiceImpl method filterAttributeIfReadNotAllowed.
protected void filterAttributeIfReadNotAllowed(Tenant tenant, Iterator<String> attributeNamesIter, List<AttributeDefinition> attributeDefinitions) throws PermissionException, AttributeNotDefinedException {
String tenantName = tenant.getName();
String attributeName = attributeNamesIter.next();
AttributeDefinition definition = findAttributeDefinition(attributeDefinitions, attributeName);
if (definition != null) {
if (!isAttributeActionAllowed(definition, AttributeAction.READ_ATTRIBUTE)) {
attributeNamesIter.remove();
}
} else {
throw new AttributeNotDefinedException(attributeName, tenantName);
}
}
Aggregations