Skip to content
Snippets Groups Projects

fix: fix validation when creating a comment for a publication

Merged Alicia.DeDiosFuente requested to merge adf-fix-validation-rules into master
@@ -36,7 +36,7 @@ public class CommentService extends AouResourceService<Comment> {
* Check that if it is marked as onlyForValidators, that the person linked is validator
*/
if (comment.isOnlyForValidators()) {
if (!this.userCanBypassValidationRights() || !this.personService.isAllowedToValidate(comment.getCreatorId(), comment.getPublication())) {
if (!this.userCanBypassValidationRights() && !this.personService.isAllowedToValidate(comment.getCreatorId(), comment.getPublication())) {
errors.addError(new FieldError(comment.getClass().getSimpleName(), "onlyForValidators", "This value is not permitted."));
}
}
Loading