Skip to content

Refactor project-group link services

Manoj M J [On PTO] requested to merge mmj-refactor-api into master

What does this MR do and why?

Why refactor these perfectly good services?

We need to refactor services associated with ProjectGroupLinks as a precursor to implementing #233408 (closed), see draft MR: !133674 (diffs)

What does this MR do?

Essentially, this MR does 2 basic things:

  • services currently associated with project-group links destroy and update, do not have permission checks inside the service. They are in the outer layer now, ie, in the controllers and the API layer, which isn't great. If we pull them into the service itself, we have an added layer of security. Plus, when we want to implement !133674 (diffs), permission checks needs to be part of the service layer anyway, so it is better to already introduce this pattern within services. This way, the diff of !133674 (diffs) would be smaller, and thus easier for code review.

  • And, when we introduce permission checks within the services, the service has to respond with error or success (like in all our other service classes), and the callers of these services should also be rewritten such that they can respond differently to error or success cases as required. This change has been made in places where these services are called - ie, in controllers and the API layer.

  • Changes to specs of service classes so as to test all of the changes.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Manoj M J [On PTO]

Merge request reports