Repository navigation
fix(permissions): manage admin-authored group_type_role member rights (#65) - #88
Merged
Merged
Conversation
…#65) The reconciler excluded EVERY group_type_role right with authId >= 10000 (isInheritedOnlyRight), on the assumption they are inherited-only and "not writable". That is too broad: verified live on eqrm prod group_type_role/9, 24 of those rows are admin-authored DIRECT grants (isInherited: false, modifiedPid 1/3891) — the curated member permissions (Add group members, Edit memberships, Planner, security levels, …) that CT lets you write. The old cutoff meant ct could neither adopt nor reconcile them, so a dev instance with only the creation-time defaults could never be brought to match prod. Remove the authId-based exclusion entirely. The reconciliation boundary is now SOLELY normalizeActual's existing filters — it drops the self-re-adding system baseline (modifiedPid === -1) and every isInherited row — so admin-authored direct grants at any authId are managed, while the platform baseline and true inheritance are still never adopted or revoked (the #65 no-op guarantee holds). - grants.ts: drop isInheritedOnlyRight + INHERITED_RIGHT_MIN_AUTH_ID. - plan.ts: desiredTuples no longer rejects authId >= 10000; buildPermissionPlan no longer special-excludes those live rows (nor emits the "inherited right" note). - adopt.ts: emits admin-authored authId >= 10000 rights as active grants. - docs + tests updated; #65 regression coverage rewritten to assert the correct boundary (admin-authored managed; system-baseline + isInherited excluded). Refs #65
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.
Problem
ct's permission reconciler excluded every
group_type_roleright withauthId >= 10000(isInheritedOnlyRight), assuming they're inherited-only and "not writable". That's too broad. Verified live on eqrm prodgroup_type_role/9(Struktur): 24 of those rows are admin-authored DIRECT grants —isInherited: false,modifiedPid1/3891 — the curated member permissions (Add group members, Edit memberships, Planner, security levels, …) that ChurchTools lets you write.Consequence surfaced live on eqrm-dev: dev's Struktur type has only the creation-time default member permissions (8, all
modifiedPid: -1, security level 1), while prod has 27 admin-curated ones (security level 2). Because ct excluded allauthId >= 10000, it could neither adopt prod's set nor apply it to dev — dev could never be brought to match prod.Fix
Remove the authId-based exclusion. The reconciliation boundary is now solely
normalizeActual's existing filters: it drops the self-re-adding system baseline (modifiedPid === -1) and everyisInheritedrow. So admin-authored direct grants at any authId are managed, while the platform baseline and true inheritance are still never adopted or revoked — the #65 no-op guarantee holds (verified by the rewritten regression test).grants.ts: dropisInheritedOnlyRight+INHERITED_RIGHT_MIN_AUTH_ID.plan.ts:desiredTuplesno longer rejectsauthId >= 10000;buildPermissionPlanno longer special-excludes those live rows (nor emits the "inherited right" note).adopt.ts: emits admin-authoredauthId >= 10000rights as active grants.docs/permissions.md+ tests updated; bug(permissions): plan demands revokes for inherited rights (authId ≥ 10000) that cannot be declared — no-op impossible on role domains with inheritance #65 coverage rewritten to assert the correct boundary (admin-authored managed; system-baseline +isInheritedexcluded — with excluded rows carryingauthId >= 10000too, proving the authId isn't the cutoff).Verification
npm run lint/typecheckclean ·npm test→ 560 passed | 5 skipped.Live (done by a human, after merge): re-adopt prod's Struktur grants →
ct plan --env prodno-op (proves the full admin-authored set is captured, no spurious revokes) →ct apply --env devwrites the ~19 missing member rights to dev. Only dev is applied; prod stays no-op.Refs #65