fix: refs #6598 get acls
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2024-05-15 17:24:01 +02:00
parent 4f38ae3745
commit 12ff55a010
1 changed files with 8 additions and 9 deletions

View File

@ -1,5 +1,5 @@
import { useState } from './useState';
import axios from 'axios';
import { useState } from './useState';
export function useAcl() {
const state = useState();
@ -17,14 +17,13 @@ export function useAcl() {
}
function hasAny(model, property, accessType) {
const acls = acls[model];
if (acls) {
for (const prop of ['*', property]) {
const acl = acls[prop];
if (acl && (acl['*'] || acl[accessType])) return true;
}
}
return false;
const modelAcls = state.getAcls().value[model];
if (!modelAcls) return false;
return ['*', property].some(prop => {
const acl = modelAcls[prop];
return acl && (acl['*'] || acl[accessType]);
});
}
return {