Re-organize a few methods and add documentation
What does this MR do and why?
This code change reorganizes and improves the search authorization system in GitLab's Elasticsearch integration. The main changes include:
Code Organization: Several methods were moved from the Filters class to a shared AuthorizationUtils module to reduce duplication and improve maintainability. This includes methods for finding projects and groups that users can access.
Better Documentation: Added detailed comments explaining what each method does, including parameter descriptions and return types, making the code easier for developers to understand and maintain.
Improved Testing: Updated a test to be more robust by using inline job processing and comparing results as arrays to avoid random ordering issues that could cause test failures.
Legacy Method Marking: Added deprecation notices to older authorization methods, indicating they're kept for backward compatibility but shouldn't be used in new code.
New Helper Method: Added a utility method allowed_ids_by_ability to filter items based on user permissions more efficiently.
The changes don't alter the core functionality but make the codebase cleaner, better documented, and more maintainable for future development work. The authorization logic remains the same - it still properly restricts search results based on what users are allowed to see.
References
- Related to Support group access for zoekt traversal ids (#557409 - closed)
- Work broken up into 3 MRs
-
⭐ code re-organization - !202287 (merged) - group access and shared group access support - !201019 (merged)
- custom role
:read_codeaccess support - !202293 (merged)
-
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.