NamespaceManager.set(NAMESPACE);
email = email.toLowerCase();
UserEntity entity = ofy().load().type(UserEntity.class).id(email).get();
if (entity == null)
throw new APIException(Status.ERROR_RESOURCE_DOES_NOT_EXIST,
"User [" + email + "] not found");
privilege = privilege.toUpperCase();
if (! PrivilegeRepository.getAllPrivileges().contains(privilege))
throw new APIException(Status.ERROR_RESOURCE_DOES_NOT_EXIST,
"Privilege [" + privilege + "] is not valid");
if (! entity.privileges.contains(privilege))
throw new APIException(Status.ERROR_RESOURCE_ALREADY_EXISTS,
"User [" + email + "] already does not have privilege [" + privilege + "]");
entity.privileges.remove(privilege);
ofy().save().entity(entity).now();
}