Skip to content

Commit

Permalink
remove boolean branches
Browse files Browse the repository at this point in the history
  • Loading branch information
dcousens committed Oct 5, 2022
1 parent 22b47dd commit 99aa16c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/core/src/lib/core/access-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export function parseListAccessControl(
};
}

if (typeof access?.filter === 'boolean' || typeof access?.filter === 'function') {
if (typeof access?.filter === 'function') {
filter = { query: access.filter, update: access.filter, delete: access.filter };
} else {
filter = {
Expand All @@ -173,7 +173,7 @@ export function parseListAccessControl(
};
}

if (typeof access?.item === 'boolean' || typeof access?.item === 'function') {
if (typeof access?.item === 'function') {
item = { create: access.item, update: access.item, delete: access.item };
} else {
item = {
Expand All @@ -183,6 +183,7 @@ export function parseListAccessControl(
delete: access?.item?.delete ?? (() => true),
};
}

return { operation, filter, item };
}

Expand Down

0 comments on commit 99aa16c

Please sign in to comment.