fix: refs #6598 get acls
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
4f38ae3745
commit
12ff55a010
|
@ -1,5 +1,5 @@
|
||||||
import { useState } from './useState';
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import { useState } from './useState';
|
||||||
|
|
||||||
export function useAcl() {
|
export function useAcl() {
|
||||||
const state = useState();
|
const state = useState();
|
||||||
|
@ -17,14 +17,13 @@ export function useAcl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasAny(model, property, accessType) {
|
function hasAny(model, property, accessType) {
|
||||||
const acls = acls[model];
|
const modelAcls = state.getAcls().value[model];
|
||||||
if (acls) {
|
if (!modelAcls) return false;
|
||||||
for (const prop of ['*', property]) {
|
|
||||||
const acl = acls[prop];
|
return ['*', property].some(prop => {
|
||||||
if (acl && (acl['*'] || acl[accessType])) return true;
|
const acl = modelAcls[prop];
|
||||||
}
|
return acl && (acl['*'] || acl[accessType]);
|
||||||
}
|
});
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue