Scope admin user badges to their area

What does this MR do and why?

In the organization admin area, badges that describe instance-level privileges and licensing were rendered for organization owners. An Admin badge in that context is ambiguous (it reads as "admin of this organization" when it actually means instance administrator) and, together with Auditor, External, and Is using seat, it exposes instance-level information that organization owners should not see.

The data behind these badges (admin, auditor, external, license-seat usage) is already gated elsewhere by read_admin_users on :global — for example the REST API exposes is_admin, is_auditor and using_license_seat behind that same check. So this MR gates the instance badges with read_admin_users on :global rather than introducing a badge-specific permission that would drift from the other places the same data is exposed.

user_badges_in_admin_section routes to instance_user_badges or organization_user_badges based on whether an organization context is present:

  • instance_user_badges returns the instance-level badges only when the viewer has read_admin_users on :global. Instance admins and custom admin roles with read_admin_users have it; organization owners do not.
  • organization_user_badges returns the Organization admin badge, which is just the user's organization access level. The caller already authorizes read_organization_user, so no extra check is needed.

Badges split into:

  • Instance-level (shown to instance admins only): Admin, Auditor, External, Is using seat.
  • Organization-scoped (shown to organization admins): Organization admin.
  • Common (not sensitive, shown in both areas): Blocked, Bot, Deactivated, Locked, Placeholder, LDAP, It's you!. These match what group and project member lists already surface.

It also fixes a disclosure on the organization Users GraphQL page (OrganizationUserType#badges), which called user_badges_in_admin_section without an organization context and so rendered instance badges to organization owners. The organization is now passed through, and the permission check backs it up.

The email/note gating in !257399 (merged) is a related but separate change; it will be reconciled with this context-and-permission approach after that MR merges.

References

Screenshots or screen recordings

Before After
Organization admin Screenshot 2026-09-28 at 2.44.15 PM.png Screenshot 2026-09-28 at 2.43.48 PM.png
Instance admin Screenshot 2026-09-28 at 2.43.42 PM.png Screenshot 2026-09-28 at 2.44.15 PM.png

How to set up and validate locally

  1. Sign in as an instance admin and confirm a user shows the Admin badge in the instance admin area (/admin/users).
  2. As a non-admin, create an organization and open Manage organization.
  3. Add the instance admin user to the organization.
  4. On the organization Users list, confirm the Admin (and, on EE, Auditor, External, Is using seat) badges are no longer shown.
  5. Make a user an organization owner and confirm the Organization admin badge still appears there.

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 Drew Blessing

Merge request reports

Loading
Loading