fix(sdk): reflect policies permission system in policy/user types#27152
Merged
AlexGaillard merged 2 commits intodirectus:mainfrom Apr 16, 2026
Merged
Conversation
directus_policies.users, directus_policies.roles and directus_users.policies
are M2M relations through directus_access, but the SDK types had them typed
as direct arrays of DirectusUser / DirectusRole / DirectusPolicy. That meant
payloads built from these types didn't match the API at runtime (e.g.
creating a policy with users required each entry to be a { user: id } access
item, not a user id).
Retype them as DirectusAccess[] to match the schema.
Closes directus#25757
Member
Member
|
We will reopen this as an exception as these changes are simple enough to review quickly. |
Updated SDK types to correctly link to the directus_access junction collection, reflecting the policies permission system.
AlexGaillard
approved these changes
Apr 16, 2026
formfcw
pushed a commit
that referenced
this pull request
Apr 20, 2026
…7152) * fix(sdk): reflect policies permission system in policy/user types directus_policies.users, directus_policies.roles and directus_users.policies are M2M relations through directus_access, but the SDK types had them typed as direct arrays of DirectusUser / DirectusRole / DirectusPolicy. That meant payloads built from these types didn't match the API at runtime (e.g. creating a policy with users required each entry to be a { user: id } access item, not a user id). Retype them as DirectusAccess[] to match the schema. Closes #25757 * Fix SDK types for user access relations Updated SDK types to correctly link to the directus_access junction collection, reflecting the policies permission system. --------- Co-authored-by: Nitwel <mail@nitwel.de>
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.
@Nitwel pointed out in #25757 that
usersondirectus_policiesis typed as a plain user array in the SDK, even though the policies permission system stores it as M2M throughdirectus_access. Same pattern applies todirectus_policies.rolesanddirectus_users.policies.This PR retypes those three relation fields to
DirectusAccess[]to match the actual schema (confirmed bypackages/system-data/src/fields/policies.yamlandusers.yaml— both declare the fields aslist-m2mwith adirectus_accessjunction).This is a breaking type change in the sense that strictly-typed user code will now need to reference
DirectusAccessshapes instead ofDirectusUser/DirectusPolicydirectly, but it matches the runtime payload the API expects.Closes #25757