filters=HavaloAuthenticationFilter.class)
public final CuracaoEntity delete(final ObjectKey key,
final KeyPair userKp) throws Exception {
// Only admin level users have the right to delete repositories.
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.