Skip to content

Commit

Permalink
chore: add scopes for Workspaces (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
unknwon authored Sep 17, 2024
1 parent 35e9505 commit 051dc74
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scopes/scopes.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ var (
PermissionEnterprisePortalSubscriptionPermission,
PermissionEnterprisePortalCodyAccess,
}
workspacesPermissions = []Permission{
"workspace",
}
)

const (
Expand Down Expand Up @@ -153,6 +156,7 @@ func Allowed() AllowedScopes {
appendScopes(services.SAMS, samsPermissions)
appendScopes(services.TelemetryGateway, telemetryGatewayPermissions)
appendScopes(services.EnterprisePortal, enterprisePortalPermissions)
appendScopes(services.Workspaces, workspacesPermissions)
// 👉 ADD YOUR SCOPES HERE
return allowed
}
Expand Down
3 changes: 3 additions & 0 deletions scopes/scopes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ func TestAllowedGoldenList(t *testing.T) {
Scope("enterprise_portal::codyaccess::read"),
Scope("enterprise_portal::codyaccess::write"),
Scope("enterprise_portal::codyaccess::delete"),
Scope("workspaces::workspace::read"),
Scope("workspaces::workspace::write"),
Scope("workspaces::workspace::delete"),
}).Equal(t, Allowed())
}

Expand Down
2 changes: 2 additions & 0 deletions services/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const (
SAMS Service = "sams"
TelemetryGateway Service = "telemetry_gateway"
EnterprisePortal Service = "enterprise_portal"
Workspaces Service = "workspaces"
SSC Service = "ssc"
)

Expand All @@ -19,6 +20,7 @@ var serviceNames = map[Service]string{
SAMS: "Sourcegraph Accounts Management System",
TelemetryGateway: "Telemetry Gateway",
EnterprisePortal: "Enterprise Portal",
Workspaces: "Workspaces",
SSC: "Self Serve Cody",
}

Expand Down

0 comments on commit 051dc74

Please sign in to comment.