Add active parameter to the Groups REST API

What does this MR do and why?

Adds active parameter for the Groups REST API which filters the following:

  • When nil, no filter is applied.
  • When true, only return groups that are not archived nor marked for deletion.
  • When false, only return groups that are archived or marked for deletion.

Query Plans

GET /groups (baseline, not affected by changes)

GET /groups?active=true

GET /groups?active=false

GET /groups/:id/subgroups?active=true

GET /groups/:id/subgroups?active=false

GET /groups/:id/descendant_groups?active=true

GET /groups/:id/descendant_groups?active=false

References

Screenshots or screen recordings

N/A

How to set up and validate locally

  1. Enable EE license in your instance.
  2. Mark a group for adjourned deletion in Group > Settings > General > Advanced
  3. Mark a group for archive with Group.find(...).archive!
  4. Call the following HTTP requests to the REST API
    • curl -X GET "http://localhost:3000/api/v4/groups?active=<param>" -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
    • curl -X GET "http://localhost:3000/api/v4/groups/:id/subgroups?active=<param>" -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
    • curl -X GET "http://localhost:3000/api/v4/groups/:id/descendant_groups?active=<param>" -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

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 Shane Maglangit

Merge request reports

Loading