From 960f0b17b11b373c5ba230d3d45282281cdb4d6f Mon Sep 17 00:00:00 2001 From: Justin Alex Paramanandan <1155821+jusuchin85@users.noreply.github.com> Date: Wed, 9 Jul 2025 16:16:01 +1000 Subject: [PATCH 1/4] Add query to list organization memberships for a user Added a GraphQL query to list the organizations a user belongs to on GitHub.com. This query retrieves the organization name and slug for each organization. --- graphql/queries/user-org-membership.graphql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 graphql/queries/user-org-membership.graphql diff --git a/graphql/queries/user-org-membership.graphql b/graphql/queries/user-org-membership.graphql new file mode 100644 index 000000000..2f6486510 --- /dev/null +++ b/graphql/queries/user-org-membership.graphql @@ -0,0 +1,15 @@ +# This GraphQL query can be used to generate a list of organizations a user belongs to on GitHub.com +# replace GITHUB_LOGIN with the username that you would like to view +# +# Note: the organizations listed are only ones that the calling user is a member of. If the calling member is not part of any organizations that the searched user belong to, it will not be shown here. + +query GetUserOrganizations { + user(login: "GITHUB_LOGIN") { + organizations(first: 100) { + nodes { + organization_name: name + organization_slug: login + } + } + } +} From 0f47f0daffaaee954e6fad20612580587ca8477e Mon Sep 17 00:00:00 2001 From: Justin Alex Paramanandan <1155821+jusuchin85@users.noreply.github.com> Date: Fri, 22 Aug 2025 14:53:36 +1000 Subject: [PATCH 2/4] Add GraphQL query to list SCIM accounts for an EMU This commit adds a GraphQL query to list SCIM accounts for an EMU (Enterprise Managed Users) enterprise account. The query retrieves details about enterprise members and their SCIM account information, which is useful for managing user accounts in GitHub Enterprise Cloud. --- .../queries/emu-list-scim-accounts.graphql | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 graphql/queries/emu-list-scim-accounts.graphql diff --git a/graphql/queries/emu-list-scim-accounts.graphql b/graphql/queries/emu-list-scim-accounts.graphql new file mode 100644 index 000000000..d596e16ce --- /dev/null +++ b/graphql/queries/emu-list-scim-accounts.graphql @@ -0,0 +1,26 @@ +# This GraphQL query can be used to generate a list of enterprise members and their SCIM account details in a GitHub Enterprise Cloud with Managed Users (EMU) enterprise account. +# +# Replace `ENTEPRISE_SLUG` with the slug of your enterprise. To get more than 10 members, you can adjust the "first" parameter. +# +# Note: the output will include suspended users (identified with their obfuscated account name), but it will not include personal user accounts that are not part of the EMU (Enterprise Managed Users) system. + +query ListAllEnterpriseUsers { + enterprise(slug: "ENTEPRISE_SLUG") { + ownerInfo { + samlIdentityProvider { + externalIdentities(first: 10) { + nodes { + user { + login + name + } + scimIdentity { + username + groups + } + } + } + } + } + } +} From 69acdac3f052d0a9d33cce235b554d76aad8111d Mon Sep 17 00:00:00 2001 From: Justin Alex <1155821+jusuchin85@users.noreply.github.com> Date: Fri, 22 Aug 2025 14:57:01 +1000 Subject: [PATCH 3/4] Update graphql/queries/emu-list-scim-accounts.graphql Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- graphql/queries/emu-list-scim-accounts.graphql | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/graphql/queries/emu-list-scim-accounts.graphql b/graphql/queries/emu-list-scim-accounts.graphql index d596e16ce..317399336 100644 --- a/graphql/queries/emu-list-scim-accounts.graphql +++ b/graphql/queries/emu-list-scim-accounts.graphql @@ -5,7 +5,12 @@ # Note: the output will include suspended users (identified with their obfuscated account name), but it will not include personal user accounts that are not part of the EMU (Enterprise Managed Users) system. query ListAllEnterpriseUsers { - enterprise(slug: "ENTEPRISE_SLUG") { +# Replace `ENTERPRISE_SLUG` with the slug of your enterprise. To get more than 10 members, you can adjust the "first" parameter. +# +# Note: the output will include suspended users (identified with their obfuscated account name), but it will not include personal user accounts that are not part of the EMU (Enterprise Managed Users) system. + +query ListAllEnterpriseUsers { + enterprise(slug: "ENTERPRISE_SLUG") { ownerInfo { samlIdentityProvider { externalIdentities(first: 10) { From c096ff5f8cbd0149554f0df82e6128767f126750 Mon Sep 17 00:00:00 2001 From: Justin Alex Paramanandan <1155821+jusuchin85@users.noreply.github.com> Date: Fri, 22 Aug 2025 15:22:02 +1000 Subject: [PATCH 4/4] Update emu-scim query to include PAT scopes --- graphql/queries/emu-list-scim-accounts.graphql | 1 + 1 file changed, 1 insertion(+) diff --git a/graphql/queries/emu-list-scim-accounts.graphql b/graphql/queries/emu-list-scim-accounts.graphql index 317399336..3ac1e9f2f 100644 --- a/graphql/queries/emu-list-scim-accounts.graphql +++ b/graphql/queries/emu-list-scim-accounts.graphql @@ -1,5 +1,6 @@ # This GraphQL query can be used to generate a list of enterprise members and their SCIM account details in a GitHub Enterprise Cloud with Managed Users (EMU) enterprise account. # +# Please ensure that your Personal Access Token (PAT) has the "read:enterprise" scope to access enterprise-level data. # Replace `ENTEPRISE_SLUG` with the slug of your enterprise. To get more than 10 members, you can adjust the "first" parameter. # # Note: the output will include suspended users (identified with their obfuscated account name), but it will not include personal user accounts that are not part of the EMU (Enterprise Managed Users) system.