handleError(err, req, res);
}
}
private void checkRequiresCapability() throws RequireCapabilityException {
RequiresCapability rc = getClass().getAnnotation(RequiresCapability.class);
if (rc != null) {
CurrentUser user = currentUser.get();
CapabilityControl ctl = user.getCapabilities();
if (!ctl.canPerform(rc.value()) && !ctl.canAdministrateServer()) {
String msg = String.format(
"fatal: %s does not have \"%s\" capability.",
Objects.firstNonNull(user.getUserName(),
((IdentifiedUser)user).getNameEmail()),
rc.value());
throw new RequireCapabilityException(msg);
}
}
}