Loading
Fix organization scoping in REST API project list endpoints
What does this MR do and why?
Fix organization scoping in the REST API project list endpoints.
ProjectsFinder#by_organization reads params[:organization] to filter projects by organization, but load_projects in lib/api/projects.rb was passing current_organization: (wrong key) instead of organization:. This caused the organization filter to be silently ignored, so GET /projects and GET /users/:user_id/projects returned projects from all organizations instead of only the current one.
This is the same defect already fixed for the Explore controller in !251487 (merged).
References
- Closes #620655
- Related: !251487 (merged) (Explore controller fix, mirrored here)
- Related: !246815 (merged)
Screenshots or screen recordings
backend-only fix, no UI changes.
How to set up and validate locally
- In a Rails console, set Current.organization to a specific organization.
- Call GET /api/v4/projects. Before this fix, projects from other organizations were returned. After the fix, only projects in the current organization are returned.
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.
Edited by Jennifer Li