fix(pairing): treat operator.admin as satisfying operator.write

This commit is contained in:
vignesh07
2026-02-21 17:55:22 -08:00
committed by Vignesh
parent a37e12eabc
commit 426d97797d
3 changed files with 15 additions and 5 deletions

View File

@@ -26,14 +26,21 @@ describe("roleScopesAllow", () => {
).toBe(true);
});
it("keeps non-read operator scopes explicit", () => {
it("treats operator.write as satisfied by write/admin scopes", () => {
expect(
roleScopesAllow({
role: "operator",
requestedScopes: ["operator.write"],
allowedScopes: ["operator.write"],
}),
).toBe(true);
expect(
roleScopesAllow({
role: "operator",
requestedScopes: ["operator.write"],
allowedScopes: ["operator.admin"],
}),
).toBe(false);
).toBe(true);
});
it("uses strict matching for non-operator roles", () => {