if(!userKp.isAdmin()) {
throw new RepositoryForbiddenException("Authenticated " +
"user does not have permission to delete repositories: " +
"(userId=" + userKp.getKey() + ", repoId=" + key + ")");
}
final HavaloUUID toDelete = new HavaloUUID(key.getDecodedKey());
// Admin users cannot delete the root "admin" repository.
if(adminUUID_.equals(toDelete)) {
throw new RepositoryForbiddenException("Authenticated " +
"admin user attempted to delete admin repository: " +
toDelete.getId());
}
// Attempt to delete the repository, its meta data, and all
// objects inside of it.
deleteRepository(toDelete);
return new StatusCodeOnlyCuracaoEntity(SC_NO_CONTENT);