// Check permissions for current principal on the owner:
if ((principal instanceof UserPrincipal) &&
!principal.canAccess(owner, SubResource.CONSUMERS, Access.CREATE)) {
log.warn("User {} does not have access to create consumers in org {}",
principal.getPrincipalName(), owner.getKey());
throw new NotFoundException(i18n.tr(
"owner with key: {0} was not found.", owner.getKey()));
}
return owner;
}