Skip to content

Add GraphQL to list all organizations in an instance for admin area

Abdul Wadood requested to merge 431756-graphql-query-list-admin-orgs into master

What does this MR do and why?

This is part of the ongoing Organization work by the grouptenant scale group. Read the blueprint to learn more https://docs.gitlab.com/ee/architecture/blueprints/organization/index.html.

Currently, we return all organizations for unauthenticated users as well because for the Organization MVC, all the organizations are public.

Query plans

Raw query
SELECT "organizations".* FROM "organizations" ORDER BY "organizations"."id" DESC

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/24982/commands/79300

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.

How to set up and validate locally

Run the following query on https://gdk.test:3000/-/graphql-explorer:

GraphQL query
{
  organizations(first: 3) {
    nodes {
      id
    }
  }
}
Sample output
{
  "data": {
    "organizations": {
      "nodes": [
        {
          "id": "gid://gitlab/Organizations::Organization/1033"
        },
        {
          "id": "gid://gitlab/Organizations::Organization/1032"
        },
        {
          "id": "gid://gitlab/Organizations::Organization/1031"
        }
      ]
    }
  }
}

Related to #431756 (closed)

Edited by Abdul Wadood

Merge request reports