Skip to content

Commit

Permalink
Fix permission.ts compatibility with Directus 10.9.1+
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshTheDerf authored Mar 5, 2024
1 parent adc2733 commit 7aee458
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/composables/use-permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ export function usePermissions(collection: Ref<string>, item: Ref<any>, isNew: R

if (userStore.currentUser?.role?.admin_access === true) return fields;

const permissions = permissionsStore.getPermissionsForUser(collection.value, isNew.value ? 'create' : 'update');
const permissions = permissionsStore.getPermission(collection.value, isNew.value ? 'create' : 'update');

// remove fields without read permissions so they don't show up in the DOM
const readableFields = permissionsStore.getPermissionsForUser(collection.value, 'read')?.fields;
const readableFields = permissionsStore.getPermission(collection.value, 'read')?.fields;
if (readableFields && readableFields.includes('*') === false) {
fields = fields.filter((field) => readableFields.includes(field.field));
}
Expand Down

0 comments on commit 7aee458

Please sign in to comment.