Gateway/Pairing: restore scope allow helper openclaw#20703 thanks @coygeek

This commit is contained in:
mbelinky
2026-02-20 18:36:59 +01:00
parent 9e3f96982e
commit 4f2c2ecef4

View File

@@ -177,6 +177,17 @@ function mergePendingDevicePairingRequest(
};
}
function scopesAllow(requested: string[], allowed: string[]): boolean {
if (requested.length === 0) {
return true;
}
if (allowed.length === 0) {
return false;
}
const allowedSet = new Set(allowed);
return requested.every((scope) => allowedSet.has(scope));
}
const DEVICE_SCOPE_IMPLICATIONS: Readonly<Record<string, readonly string[]>> = {
"operator.admin": ["operator.read", "operator.write", "operator.approvals", "operator.pairing"],
"operator.write": ["operator.read"],