You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(perms): tighten comments and drop dead code
Cleanup pass on the issue-37 permission-filtering work — no behaviour
changes, all 180 unit tests still pass, browser-verified across admin,
restricted-with-PK and restricted-without-PK scenarios.
- `fieldsWithRelational`: the previous `// CRITICAL: Always include the
primary key field` comment was misleading because sanitize permission-
filters the PK and language-code path immediately after. Comment now
states the truth: PK + language code are added before the gate so
sanitize can drop them when the user lacks read access, matching
native Directus's permission-filtered `useCollection.primaryKeyField`
(degraded interaction instead of an empty 403).
- Drop the unused `probing` ref from `useTranslationLanguages` (declared,
set, never consumed).
- Strip issue/bug-ID references from in-source comments per CLAUDE.md —
ticket pointers rot as the codebase evolves; PR descriptions own that
history.
- Compress over-long JSDoc and inline blocks in `sanitizeFilter`,
`resolveTranslationValue`, `useTranslationLanguages`, and several
spots in `super-table.vue`. WHY preserved, WHAT removed.
- Add two regression tests documenting `sanitizeFields`' contract:
primary key and `translations.languages_code` are both dropped when
not in the user's read whitelist — callers rely on this to fall back
gracefully.
Net: +84 / -109 (-25 lines), 8 files.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
28
28
-`combinedFilter` no longer mixes side-effects with computed evaluation; the user notification is now emitted from a dedicated watcher.
29
29
-`PermissionAction` union no longer includes the unused `'share'` action.
30
30
-`usePermissions` guards against array-shaped permission stores (legacy / future Directus shape changes) instead of silently failing.
31
+
-`fieldsWithRelational` clarifies its behaviour: the primary key and translation language code path are added BEFORE the permission gate, and sanitize drops them only if the user lacks read permission. This mirrors native Directus's `useCollection.primaryKeyField`, which is itself permission-filtered, so users without PK read access see the same graceful degradation in both layouts (items render with limited interaction) instead of an empty 403 error state.
31
32
32
33
### Known limitations
33
34
- Bulk-action **Edit / Delete / Add Item** buttons (rendered by Directus Core, not by this extension) remain visible-but-disabled when the user lacks the corresponding permission. A future Directus core PR is required to fully hide them.
0 commit comments