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 { 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 {
|
||||
|
|
Loading…
Reference in New Issue