mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-14 11:30:41 +00:00
Gateway/Pairing: restore scope allow helper openclaw#20703 thanks @coygeek
This commit is contained in:
@@ -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"],
|
||||
|
||||
Reference in New Issue
Block a user