mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-27 01:23:33 +00:00
refactor(gateway): dedupe default operator connect scopes
This commit is contained in:
@@ -15,7 +15,7 @@ struct ConnectOptions {
|
||||
var clientMode: String = "ui"
|
||||
var displayName: String?
|
||||
var role: String = "operator"
|
||||
var scopes: [String] = ["operator.admin", "operator.read", "operator.write", "operator.approvals", "operator.pairing"]
|
||||
var scopes: [String] = defaultOperatorConnectScopes
|
||||
var help: Bool = false
|
||||
|
||||
static func parse(_ args: [String]) -> ConnectOptions {
|
||||
|
||||
7
apps/macos/Sources/OpenClawMacCLI/GatewayScopes.swift
Normal file
7
apps/macos/Sources/OpenClawMacCLI/GatewayScopes.swift
Normal file
@@ -0,0 +1,7 @@
|
||||
let defaultOperatorConnectScopes: [String] = [
|
||||
"operator.admin",
|
||||
"operator.read",
|
||||
"operator.write",
|
||||
"operator.approvals",
|
||||
"operator.pairing",
|
||||
]
|
||||
@@ -251,7 +251,7 @@ actor GatewayWizardClient {
|
||||
let clientMode = "ui"
|
||||
let role = "operator"
|
||||
// Explicit scopes; gateway no longer defaults empty scopes to admin.
|
||||
let scopes: [String] = ["operator.admin", "operator.read", "operator.write", "operator.approvals", "operator.pairing"]
|
||||
let scopes = defaultOperatorConnectScopes
|
||||
let client: [String: ProtoAnyCodable] = [
|
||||
"id": ProtoAnyCodable(clientId),
|
||||
"displayName": ProtoAnyCodable(Host.current().localizedName ?? "OpenClaw macOS Wizard CLI"),
|
||||
|
||||
@@ -127,6 +127,14 @@ private enum ConnectChallengeError: Error {
|
||||
case timeout
|
||||
}
|
||||
|
||||
private let defaultOperatorConnectScopes: [String] = [
|
||||
"operator.admin",
|
||||
"operator.read",
|
||||
"operator.write",
|
||||
"operator.approvals",
|
||||
"operator.pairing",
|
||||
]
|
||||
|
||||
public actor GatewayChannelActor {
|
||||
private let logger = Logger(subsystem: "ai.openclaw", category: "gateway")
|
||||
private var task: WebSocketTaskBox?
|
||||
@@ -318,7 +326,7 @@ public actor GatewayChannelActor {
|
||||
let primaryLocale = Locale.preferredLanguages.first ?? Locale.current.identifier
|
||||
let options = self.connectOptions ?? GatewayConnectOptions(
|
||||
role: "operator",
|
||||
scopes: ["operator.admin", "operator.read", "operator.write", "operator.approvals", "operator.pairing"],
|
||||
scopes: defaultOperatorConnectScopes,
|
||||
caps: [],
|
||||
commands: [],
|
||||
permissions: [:],
|
||||
|
||||
Reference in New Issue
Block a user