mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 14:01:12 +00:00
Gateway: allow operator admin scope for pairing and approvals
This commit is contained in:
@@ -43,6 +43,33 @@ describe("roleScopesAllow", () => {
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("treats operator.approvals/operator.pairing as satisfied by operator.admin", () => {
|
||||
expect(
|
||||
roleScopesAllow({
|
||||
role: "operator",
|
||||
requestedScopes: ["operator.approvals"],
|
||||
allowedScopes: ["operator.admin"],
|
||||
}),
|
||||
).toBe(true);
|
||||
expect(
|
||||
roleScopesAllow({
|
||||
role: "operator",
|
||||
requestedScopes: ["operator.pairing"],
|
||||
allowedScopes: ["operator.admin"],
|
||||
}),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("does not treat operator.admin as satisfying non-operator scopes", () => {
|
||||
expect(
|
||||
roleScopesAllow({
|
||||
role: "operator",
|
||||
requestedScopes: ["system.run"],
|
||||
allowedScopes: ["operator.admin"],
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("uses strict matching for non-operator roles", () => {
|
||||
expect(
|
||||
roleScopesAllow({
|
||||
|
||||
Reference in New Issue
Block a user