Skip to content

Commit

Permalink
Merge pull request #2 from JoshTheDerf/patch-1
Browse files Browse the repository at this point in the history
Fix permission.ts compatibility with Directus 10.9.1+
  • Loading branch information
hanneskuettner authored Mar 7, 2024
2 parents adc2733 + 7aee458 commit 19f373d
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 19f373d

Please sign in to comment.