Search in sources :

Example 1 with AttributeNotDefinedException

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);
    }
}
Also used : AttributeDefinition(org.craftercms.profile.api.AttributeDefinition) AttributeNotDefinedException(org.craftercms.profile.exceptions.AttributeNotDefinedException)

Aggregations

AttributeDefinition (org.craftercms.profile.api.AttributeDefinition)1 AttributeNotDefinedException (org.craftercms.profile.exceptions.AttributeNotDefinedException)1