core: fix permission evaluation to use rule-based matching instead of wildcard patterns
This commit is contained in:
parent
7324b2260a
commit
9f38af44db
1 changed files with 3 additions and 3 deletions
|
|
@ -232,9 +232,9 @@ export namespace PermissionNext {
|
||||||
const result = new Set<string>()
|
const result = new Set<string>()
|
||||||
for (const tool of tools) {
|
for (const tool of tools) {
|
||||||
const permission = EDIT_TOOLS.includes(tool) ? "edit" : tool
|
const permission = EDIT_TOOLS.includes(tool) ? "edit" : tool
|
||||||
if (evaluate(permission, "*", ruleset).action === "deny") {
|
const rule = ruleset.findLast((r) => Wildcard.match(permission, r.pattern))
|
||||||
result.add(tool)
|
if (!rule) continue
|
||||||
}
|
if (rule.pattern === "*" && rule.action === "deny") result.add(tool)
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue