Skip to content

fix(state-mappings): internal admin does not unlock can_manage_users in catalog#2872

Open
ravverma wants to merge 1 commit into
mainfrom
fix/product-capabilities-exclude-internal-admin
Open

fix(state-mappings): internal admin does not unlock can_manage_users in catalog#2872
ravverma wants to merge 1 commit into
mainfrom
fix/product-capabilities-exclude-internal-admin

Conversation

@ravverma

Copy link
Copy Markdown
Contributor

What

Coherence follow-up to #2871 (block internal admins from write mutations). GET /product/capabilities now returns the catalog minus can_manage_users for an internal admin who does not hold the FACS can_manage_users claim.

Why

The assignable-catalog gate used callerHasFacsManageUsers, which counts the internal-admin bypass (isAdmin() || hasFacsPermission(...)). Since internal admins can no longer author bindings (#2871), surfacing can_manage_users as assignable to them is misleading. Only a real FACS can_manage_users claim should unlock it.

How

  • New helper callerHoldsFacsManageUsersClaim(ctx, product) — FACS claim only, no admin bypass.
  • getProductCapabilities uses it for the full-catalog gate. resolveManageAuthority (reads) is unchanged; admin reads stay allowed.

Tests

Added: internal admin (no FACS claim) gets the catalog minus can_manage_users. Existing FACS-manager / non-manager catalog tests unchanged. 21 passing; lint clean.

🤖 Generated with Claude Code

…in catalog

Coherence follow-up to the internal-admin write block: GET /product/capabilities
gated the full catalog (incl. can_manage_users) on callerHasFacsManageUsers,
which counts the internal-admin bypass. Since internal admins can no longer
author bindings, being an admin must not surface can_manage_users as assignable
either. Add callerHoldsFacsManageUsersClaim (FACS claim only, no admin bypass)
and use it for the catalog gate; admins now get the catalog minus can_manage_users.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant