Expose sharing rules through the metadata API - #25447
Draft
martmull wants to merge 1 commit into
Draft
Conversation
Add the sharingRule GraphQL surface: sharingRules(objectMetadataId), createSharingRule, updateSharingRule and deleteSharingRule, guarded by the data model settings permission and run through the workspace migration runner. Row-level permission predicates now accept either a roleId or a sharingRuleId as parent, and a rule's predicates resolve from the rule. Generated front and client SDK metadata types are regenerated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #25444 (sharingRule entity). Second half of PR 12 of the record sharing build plan (core-team-issues #2822): the metadata GraphQL surface for sharing rules.
What
sharingRules(objectMetadataId)query andcreateSharingRule,updateSharingRule,deleteSharingRulemutations underWorkspaceAuthGuardandSettingsPermissionGuard(DATA_MODEL), running throughvalidateBuildAndRunWorkspaceMigrationlike the other metadata entities. Rules are created with a fresh universal identifier in the workspace custom application;objectMetadataIdandapplicationIdare not editable.SharingRuleDTOresolves itsrowLevelPermissionPredicatesandrowLevelPermissionPredicateGroups, filtered bysharingRuleId.upsertRowLevelPermissionPredicatesaccepts eitherroleIdorsharingRuleId(exactly one). The parent is resolved once, the rule must belong to the same object as the predicates, the ownership and enterprise checks are the ones the role path already runs, and predicates of other parents are never touched. Predicate DTOs carry a nullableroleIdand asharingRuleId.RecordShareAccessLevelandRecordSharePrincipalTypeenums are reused from the record share DTOs.twenty-frontmetadata types andtwenty-client-sdkmetadata schema regenerated.Tests
sharing-rule-crud.integration-spec.ts: create, list and update; criteria attached to a rule throughupsertRowLevelPermissionPredicateswithroleId: null; both parents refused; ROLE grantee without a role refused; a member without the data model permission refused; delete cascades the predicates and a later upsert against the deleted rule returnsSHARING_RULE_NOT_FOUND.Stack
Generated by Claude Code