forked from verdnatura/salix-front
chore: refs #4074 admit several acls
This commit is contained in:
parent
c766110bd9
commit
dcc2f4dfde
|
@ -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]);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue