/** * Checks if current user can edit review comments * * @param comment * - comment to check permissions on * @param branchId * - ID of branch where review with comment located */ private void checkHasUpdatePermission(PostComment comment, long branchId) { JCUser currentUser = userService.getCurrentUser(); boolean canEditOwnPosts = permissionService.hasBranchPermission(branchId, BranchPermission.EDIT_OWN_POSTS); boolean canEditOthersPosts = permissionService .hasBranchPermission(branchId, BranchPermission.EDIT_OTHERS_POSTS); if (!(canEditOthersPosts && !comment.isCreatedBy(currentUser)) && !(canEditOwnPosts && comment.isCreatedBy(currentUser))) { throw new AccessDeniedException("No permission to edit comments"); } }