Skip to content

fix(permissions): manage admin-authored group_type_role member rights (#65) - #88

Merged
2000game merged 1 commit into
mainfrom
fix/permissions-narrow-inherited-exclusion-65
Jul 11, 2026
Merged

2000game merged 1 commit into
mainfrom
fix/permissions-narrow-inherited-exclusion-65

Conversation

@2000game

Copy link
Copy Markdown
Member

Problem

ct's permission reconciler excluded every group_type_role right with authId >= 10000 (isInheritedOnlyRight), assuming they're inherited-only and "not writable". That's too broad. Verified live on eqrm prod group_type_role/9 (Struktur): 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 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 all authId >= 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 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 (verified by the rewritten regression test).

Verification

npm run lint / typecheck clean · npm test → 560 passed | 5 skipped.

Live (done by a human, after merge): re-adopt prod's Struktur grants → ct plan --env prod no-op (proves the full admin-authored set is captured, no spurious revokes) → ct apply --env dev writes the ~19 missing member rights to dev. Only dev is applied; prod stays no-op.

Refs #65

…#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
@2000game
2000game merged commit 6e9035d into main Jul 11, 2026
1 check passed
@2000game
2000game deleted the fix/permissions-narrow-inherited-exclusion-65 branch July 11, 2026 20:15
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