Skip to content

Commit

Permalink
Merge pull request #6097 from deutschebank/db-contrib/waltz-6061-meas…
Browse files Browse the repository at this point in the history
…urable-ratings-permissions-fix

Db contrib/waltz 6061 measurable ratings permissions fix
  • Loading branch information
davidwatkins73 authored Jun 14, 2022
2 parents 35deb55 + ef7258e commit e389634
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private Collection<MeasurableRating> saveRoute(Request request, Response z) thro
: Operation.ADD;

checkHasPermissionForThisOperation(command.measurableId(), command.entityReference(), operation, getUsername(request));
requireRole(userRoleService, request, measurableRatingService.getRequiredRatingEditRole(mkRef(EntityKind.MEASURABLE, command.measurableId())));

return measurableRatingService.save(command, false);
}

Expand Down Expand Up @@ -188,8 +188,10 @@ private void checkHasPermissionForThisOperation(Long measurableId,
.user(username)
.build();

boolean involvementBasedPermissions = permissionGroupService.hasPermission(checkPermissionCommand);

checkTrue(
roleBasedPermissions || permissionGroupService.hasPermission(checkPermissionCommand),
roleBasedPermissions || involvementBasedPermissions,
format("User does not have permission to %s measurable ratings for this %s", operation.name().toLowerCase(), parentReference.kind().prettyName()));
}

Expand Down

0 comments on commit e389634

Please sign in to comment.