0
0
Fork 0

chore: refs #4074 admit several acls

This commit is contained in:
Jorge Penadés 2024-08-01 14:14:28 +02:00
parent c766110bd9
commit dcc2f4dfde
1 changed files with 3 additions and 2 deletions

View File

@ -16,10 +16,11 @@ export function useAcl() {
state.setAcls(acls); state.setAcls(acls);
} }
function hasAny(model, prop, accessType) { function hasAny(model, props = [], accessType) {
const acls = state.getAcls().value[model]; const acls = state.getAcls().value[model];
Array.isArray(props) || (props = [props]);
if (acls) if (acls)
return ['*', prop].some((key) => { return ['*', ...props].some((key) => {
const acl = acls[key]; const acl = acls[key];
return acl && (acl['*'] || acl[accessType]); return acl && (acl['*'] || acl[accessType]);
}); });