Refactor project custom role filter
What does this MR do and why?
This MR refactors how custom roles are checked when determining the project list allowed during searches
Before it was checking each project individually but that created an N+1. This MR grabs the list of abilities required for the feature
and checks all projects at once.
Note: this is how the old code worked, see filter_ids_by_ability
method in Elastic::Latest::GitClassProxy
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
N/A
How to set up and validate locally
I ended up writing tests to validate the N+1 was fixed, the tests fail on master
to validate this manually:
- setup elasticsearch for gdk
- create a group and 2 projects
- create a custom role with
guest
access +read_code
ability - grant a user access to a group or a project with that role
- login as that user
- enable feature flag
search_query_authorization_refactor
- perform a group search for code
- verify search works as expected
Edited by Terri Chu