Skip to content

Commit 8fd9db8

Browse files
authored
add Amp scopes (#94)
Adds scopes so we can use M2M to interact with Amp and mutate user accounts. ## Test plan CI
1 parent 6ebcb44 commit 8fd9db8

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

scopes/scopes.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ var (
127127
mailGatekeeperPermissions = []Permission{
128128
"emails",
129129
}
130+
ampPermissions = []Permission{
131+
"user",
132+
}
130133
analyticsPermissions = []Permission{
131134
"analytics",
132135
}
@@ -182,6 +185,7 @@ func Allowed() AllowedScopes {
182185
}
183186
}
184187

188+
appendScopes(services.Amp, ampPermissions)
185189
appendScopes(services.CodyGateway, codyGatewayPermissions)
186190
appendScopes(services.SAMS, samsPermissions)
187191
appendScopes(services.TelemetryGateway, telemetryGatewayPermissions)

scopes/scopes_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ func TestAllowedGoldenList(t *testing.T) {
1414
Scope("offline_access"),
1515
Scope("client.ssc"),
1616
Scope("client.dotcom"),
17+
Scope("amp::user::read"),
18+
Scope("amp::user::write"),
19+
Scope("amp::user::delete"),
1720
Scope("cody_gateway::flaggedprompts::read"),
1821
Scope("cody_gateway::flaggedprompts::write"),
1922
Scope("cody_gateway::flaggedprompts::delete"),

services/services.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ type Service string
55

66
// The list of registered services that publish scopes and/or roles.
77
const (
8+
Amp Service = "amp"
89
CodyGateway Service = "cody_gateway"
910
Dotcom Service = "dotcom"
1011
SAMS Service = "sams"
@@ -17,6 +18,7 @@ const (
1718
)
1819

1920
var serviceNames = map[Service]string{
21+
Amp: "Amp",
2022
CodyGateway: "Cody Gateway",
2123
Dotcom: "Sourcegraph Dotcom",
2224
SAMS: "Sourcegraph Accounts Management System",

0 commit comments

Comments
 (0)