From cce925c26a1a49a010006bcc4ca7a05e6594c77f Mon Sep 17 00:00:00 2001 From: Filip Haftek Date: Tue, 22 Jul 2025 14:53:30 +0200 Subject: [PATCH] CloudAPI: add service and scopes --- scopes/scopes.go | 4 ++++ scopes/scopes_test.go | 3 +++ services/services.go | 2 ++ 3 files changed, 9 insertions(+) diff --git a/scopes/scopes.go b/scopes/scopes.go index 57cd052..9170f78 100644 --- a/scopes/scopes.go +++ b/scopes/scopes.go @@ -135,6 +135,9 @@ var ( analyticsPermissions = []Permission{ "analytics", } + cloudAPIPermissions = []Permission{ + "instance", + } ) const ( @@ -199,6 +202,7 @@ func Allowed() AllowedScopes { appendScopes(services.MailGatekeeper, mailGatekeeperPermissions) appendScopes(services.Workspaces, workspacesPermissions) appendScopes(services.Analytics, analyticsPermissions) + appendScopes(services.CloudAPI, cloudAPIPermissions) // 👉 ADD YOUR SCOPES HERE return allowed } diff --git a/scopes/scopes_test.go b/scopes/scopes_test.go index 6203428..3e90dd9 100644 --- a/scopes/scopes_test.go +++ b/scopes/scopes_test.go @@ -96,6 +96,9 @@ func TestAllowedGoldenList(t *testing.T) { Scope("analytics::analytics::read"), Scope("analytics::analytics::write"), Scope("analytics::analytics::delete"), + Scope("cloud_api::instance::read"), + Scope("cloud_api::instance::write"), + Scope("cloud_api::instance::delete"), }).Equal(t, Allowed()) } diff --git a/services/services.go b/services/services.go index 72ca6bc..3b8deca 100644 --- a/services/services.go +++ b/services/services.go @@ -15,6 +15,7 @@ const ( Workspaces Service = "workspaces" SSC Service = "ssc" Analytics Service = "analytics" + CloudAPI Service = "cloud_api" ) var serviceNames = map[Service]string{ @@ -28,6 +29,7 @@ var serviceNames = map[Service]string{ Workspaces: "Workspaces", SSC: "Self Serve Cody", Analytics: "Sourcegraph Analytics", + CloudAPI: "Cloud API", } func (s Service) DisplayName() string {