Skip to content

feat: add Grant primitive XRD with polymorphic same-Org / cross-Org dispatch#8

Closed
patrickleet wants to merge 1 commit into
feat/machineuser-xrdfrom
feat/grant-xrd
Closed

feat: add Grant primitive XRD with polymorphic same-Org / cross-Org dispatch#8
patrickleet wants to merge 1 commit into
feat/machineuser-xrdfrom
feat/grant-xrd

Conversation

@patrickleet
Copy link
Copy Markdown
Contributor

Polymorphic dispatch over Zitadel's two role-assignment mechanisms. Same-Org (1 user/Grant MR) vs cross-Org (project/Grant + user/Grant with projectGrantId). Multi-iter gating on observed project/Grant.atProvider.id.

Stacked on top of PR #7 (MachineUser) — base is feat/machineuser-xrd so this PR's diff shows only Grant changes. Retarget to main once #7 merges.

21/21 KCL tests pass; 8/8 examples render.

🤖 Generated with Claude Code

…ispatch

Second auth-group primitive that survives the "is it just a single-MR
wrapper?" test. Composes 1 or 2 underlying Zitadel MRs depending on
whether the user's home Org matches the project's enclosing Org.

Same-Org (spec.userOrgId == spec.projectOrgId): one MR
  - user.zitadel.m.crossplane.io/Grant — the user's role assignment
    within the project (no projectGrantId)

Cross-Org (spec.userOrgId != spec.projectOrgId): two MRs
  - project.zitadel.m.crossplane.io/Grant — the cross-Org Project
    Grant authorizing the role set for the user's home Org
  - user.zitadel.m.crossplane.io/Grant — the user's role assignment
    with projectGrantId pointing at the Project Grant, pulling roles
    from the granted set

Multi-iter convergence: in cross-Org mode the user/Grant emits only
once the project/Grant's atProvider.id is observed (standard composition
gating per feedback_crossplane_composition_gates).

Schema takes flat IDs (userId + userOrgId + projectId + projectOrgId +
roles[]), matching the established convention from Tenant + MachineUser
— operator copies UUIDs from the relevant XR statuses or Zitadel UI.

Two examples (same-org + cross-org); 4 KCL CompositionTests covering
same-org, cross-org iter 1, multi-role, managementPolicies propagation.
Multi-iter convergence verified via observed-resources fixture.

21/21 KCL tests pass (13 AuthStack + 4 MachineUser + 4 Grant); all 8
examples render via make render:all.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7ae8f826-e5db-4e6c-8675-e216fdb49b21

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/grant-xrd

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@patrickleet patrickleet deleted the branch feat/machineuser-xrd May 21, 2026 04:42
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