feat(openfga): add b2b_org, project_membership, and key_contact types#120
feat(openfga): add b2b_org, project_membership, and key_contact types#120emsearcy wants to merge 3 commits intolinuxfoundation:mainfrom
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughBumped OpenFGA model major version 10 → 11. Removed the standalone Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Updates the OpenFGA authorization model used by the lfx-platform Helm chart to support the v2 member service architecture by introducing first-class org/membership/contact object types and versioning the model accordingly.
Changes:
- Bumps the authorization model version to
10.1.0. - Replaces the unused
membertype with newb2b_org,project_membership, andkey_contacttypes. - Adds new parent-reference and inherited-permission relations for membership and key contact records.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
charts/lfx-platform/templates/openfga/model.yaml (1)
362-365: Minor doc inconsistency: comment says "owners" but relation grants "writers".The comment states "Write access is granted to b2b_org owners" but the relation
writer: writer from b2b_orgactually grants access to anyone withwriteron the parentb2b_org(which includes both direct[user]assignments andowner). Consider updating the comment to reflect the actual inheritance:Suggested comment update
# The key_contact type represents a Salesforce Project_Role__c record: a named - # contact role assigned to a b2b_org for a specific project membership. Write - # access is granted to b2b_org owners (and transitively the global org-admin team). + # contact role assigned to a b2b_org for a specific project membership. Write + # access is granted to b2b_org writers (including owners and the global org-admin team).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@charts/lfx-platform/templates/openfga/model.yaml` around lines 362 - 365, The comment for the OpenFGA type "key_contact" is inaccurate: it says "Write access is granted to b2b_org owners" but the relation uses "writer: writer from b2b_org", which grants write access to any principal with the writer relation on the parent b2b_org (including direct writers and owners via inheritance). Update the comment above type key_contact to state that write access is granted to b2b_org writers (including owners via inheritance) or otherwise describe the actual inheritance model to match the relation "writer: writer from b2b_org".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@charts/lfx-platform/templates/openfga/model.yaml`:
- Around line 21-24: The version block currently sets major: 10 minor: 1 patch:
0 but the change adds types b2b_org, project_membership, key_contact and removes
type member, which per the in-file guidelines requires a major bump; update the
version block (the version: major/minor/patch fields) to major: 11 minor: 0
patch: 0 so the model version becomes 11.0.0.
---
Nitpick comments:
In `@charts/lfx-platform/templates/openfga/model.yaml`:
- Around line 362-365: The comment for the OpenFGA type "key_contact" is
inaccurate: it says "Write access is granted to b2b_org owners" but the relation
uses "writer: writer from b2b_org", which grants write access to any principal
with the writer relation on the parent b2b_org (including direct writers and
owners via inheritance). Update the comment above type key_contact to state that
write access is granted to b2b_org writers (including owners via inheritance) or
otherwise describe the actual inheritance model to match the relation "writer:
writer from b2b_org".
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cb9acaaa-81cc-4ccd-9d7a-d61b31bdd706
📒 Files selected for processing (1)
charts/lfx-platform/templates/openfga/model.yaml
4fcc7c9 to
211fb05
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
charts/lfx-platform/templates/openfga/model.yaml (1)
341-349: Makeglobal_org_adminstamping part of the org-create transaction.
project_membershipandkey_contactinherit their service-writer path fromb2b_org.writer. If ab2b_orgcan be created without this tuple, follow-on member-service writes will be stranded until repaired.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@charts/lfx-platform/templates/openfga/model.yaml` around lines 341 - 349, The b2b_org model allows project_membership and key_contact to inherit writer from b2b_org.writer, so ensure the tuple for relation "global_org_admin" on type "b2b_org" is written as part of the same org creation transaction: update the org creation flow (e.g., the CreateOrg or createOrgTransaction path) to include the OpenFGA tuple write for b2b_org#global_org_admin -> team#member within the same atomic operation (or use the OpenFGA multi-write/transaction API) so follow-on member-service writes never see a b2b_org without that tuple; also add idempotent/exists checks so replayed org-creates don’t duplicate the tuple.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@charts/lfx-platform/templates/openfga/model.yaml`:
- Around line 341-349: The b2b_org model allows project_membership and
key_contact to inherit writer from b2b_org.writer, so ensure the tuple for
relation "global_org_admin" on type "b2b_org" is written as part of the same org
creation transaction: update the org creation flow (e.g., the CreateOrg or
createOrgTransaction path) to include the OpenFGA tuple write for
b2b_org#global_org_admin -> team#member within the same atomic operation (or use
the OpenFGA multi-write/transaction API) so follow-on member-service writes
never see a b2b_org without that tuple; also add idempotent/exists checks so
replayed org-creates don’t duplicate the tuple.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3edb7ce2-d8ad-4051-9a36-37651be45d3a
📒 Files selected for processing (1)
charts/lfx-platform/templates/openfga/model.yaml
Add three new OpenFGA types required by the v2 member service architecture (LFXV2-1356). The stub 'member' type (unused) is replaced by the three first-class types that reflect the actual Salesforce entity model. Model version is bumped to 10.1.0 (minor addition of types). The global_org_admin relation on b2b_org provides platform-wide machine user access without a hierarchical root object; writer/auditor on project_membership and key_contact inherit from both the owning b2b_org and the parent project. Note: global_org_admin team UID and provisioning method are an open question tracked in LFXV2-1356. 🤖 Generated with [GitHub Copilot](https://github.com/features/copilot) (via OpenCode) Signed-off-by: Eric Searcy <eric@linuxfoundation.org>
- Bump version to 11.0.0 (major: type additions/deletions per guidelines) - Move global_org_admin from owner to writer on b2b_org, reserving owner for future owner-only gates (e.g. org transfer/deletion) - Add writer from project to key_contact so project-level writers (LF staff) can manage key contacts without membership write access 🤖 Generated with [GitHub Copilot](https://github.com/features/copilot) (via OpenCode) Signed-off-by: Eric Searcy <eric@linuxfoundation.org>
Add structural @fgadoc tags to the three new member service types: - @fgadoc:alias for human-readable display names - @fgadoc:hide on global_org_admin (machine-user relation, not directly assignable by humans) Regenerate PERMISSIONS.md via the render-permissions skill to include sections for all three new types. b2b_org renders as a prose section (direct-grant roles present but no JTBDs yet; routes not yet implemented in LFXV2-1360–1362). project_membership and key_contact render as prose-only with inheritance bullets (all access is inherited, no direct grants). 🤖 Generated with [GitHub Copilot](https://github.com/features/copilot) (via OpenCode) Signed-off-by: Eric Searcy <eric@linuxfoundation.org>
5e2bed5 to
c19b845
Compare
Summary
b2b_org,project_membership, andkey_contactOpenFGA types for the v2 member service architecturemembertype with these three first-class types@fgadocstructural annotations to all three new typesPERMISSIONS.mdvia therender-permissionsskill with sections for each new typeJira
LFXV2-1356 — part of epic LFXV2-1344
Changes
b2b_org— represents a Salesforce Account (B2B company):global_org_admin: [team#member]— platform-wide machine user team stamped on every instance at creation (@fgadoc:hide— not directly assignable by humans)owner: [user]— human owners only; reserved for future owner-only gates (transfer, deletion)writer: [user] or owner or global_org_admin— machine users get writer-level access (not owner)auditor: [user, team#member] or writerproject_membership— Salesforce Asset record with parent refs tob2b_organdproject:writerinherits fromb2b_orgonly (org owners + global org-admin team); project-level writers can audit but not modify membershipsauditorinherits from bothb2b_organdprojectkey_contact— SalesforceProject_Role__crecord, same parent refs:writerinherits from bothb2b_org(org owners + global org-admin) andproject(LF staff managing contacts on behalf of members)auditorinherits from bothb2b_organdprojectPERMISSIONS.md
b2b_orgrenders as a prose section (direct-grant roles exist but no@fgadoc:jtbdyet — API routes not yet implemented; will be populated by thepopulate-jtbdsskill once LFXV2-1360–1362 land).project_membershipandkey_contactrender as prose-only inheritance sections since all access is inherited.Testing
Existing FGA checks (
projectauditor/writer) are unaffected. New types will be exercised when the member service write handlers are implemented (LFXV2-1360–1362).