/** * Check at database level. */ private void checkPermit(final Map<QualifiedName, Set<String>> accessACL, final String userName, final QualifiedName name, final MetacatOperation op) { final Set<String> users = accessACL.get(QualifiedName.ofDatabase(name.getCatalogName(), name.getDatabaseName())); if ((users != null) && !users.isEmpty() && !users.contains(userName)) { throw new MetacatUnAuthorizedException(String.format("%s is not permitted for %s %s", userName, op.name(), name )); } }
} catch (MetacatUnAuthorizedException e) { collectRequestExceptionMetrics(tags, e.getClass().getSimpleName()); final String message = String.format("%s.%s -- %s failed for %s", e.getMessage(), e.getCause() == null ? "" : e.getCause().getMessage(), resourceRequestName, name); log.error(message, e); throw e;
/** * Check at database level. */ private void checkPermit(final Map<QualifiedName, Set<String>> accessACL, final String userName, final QualifiedName name, final MetacatOperation op) { final Set<String> users = accessACL.get(QualifiedName.ofDatabase(name.getCatalogName(), name.getDatabaseName())); if ((users != null) && !users.isEmpty() && !users.contains(userName)) { throw new MetacatUnAuthorizedException(String.format("%s is not permitted for %s %s", userName, op.name(), name )); } }
return new MetacatBadRequestException(message); case 403: //Forbidden return new MetacatUnAuthorizedException(message); case 404: //NOT_FOUND return new MetacatNotFoundException(message);