public void validate(final Subject subject, final int mode) throws PermissionDeniedException {
//TODO This check should not even be here! Its up to the database to refuse access not requesting source
if(!doc.getPermissions().validate(subject, mode)) {
final String modeStr = new UnixStylePermissionAider(mode).toString();
throw new PermissionDeniedException("Subject '" + subject.getName() + "' does not have '" + modeStr + "' access to resource '" + doc.getURI() + "'.");
}
}