Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf09d4cf

Browse files
committed
squish
1 parent3897ea4 commitf09d4cf

File tree

17 files changed

+597
-11
lines changed

17 files changed

+597
-11
lines changed

‎coderd/apidoc/docs.go‎

Lines changed: 76 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/apidoc/swagger.json‎

Lines changed: 70 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/idpsync/idpsync.go‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
typeIDPSyncinterface {
2727
OrganizationSyncEntitled()bool
2828
OrganizationSyncSettings(ctx context.Context,db database.Store) (*OrganizationSyncSettings,error)
29-
UpdateOrganizationSettings(ctx context.Context,db database.Store,settingsOrganizationSyncSettings)error
29+
UpdateOrganizationSyncSettings(ctx context.Context,db database.Store,settingsOrganizationSyncSettings)error
3030
// OrganizationSyncEnabled returns true if all OIDC users are assigned
3131
// to organizations via org sync settings.
3232
// This is used to know when to disable manual org membership assignment.
@@ -70,6 +70,9 @@ type IDPSync interface {
7070
SyncRoles(ctx context.Context,db database.Store,user database.User,paramsRoleParams)error
7171
}
7272

73+
// AGPLIDPSync implements the IDPSync interface
74+
var_IDPSync=AGPLIDPSync{}
75+
7376
// AGPLIDPSync is the configuration for syncing user information from an external
7477
// IDP. All related code to syncing user information should be in this package.
7578
typeAGPLIDPSyncstruct {

‎coderd/idpsync/organization.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func (AGPLIDPSync) OrganizationSyncEnabled(_ context.Context, _ database.Store)
3434
returnfalse
3535
}
3636

37-
func (sAGPLIDPSync)UpdateOrganizationSettings(ctx context.Context,db database.Store,settingsOrganizationSyncSettings)error {
37+
func (sAGPLIDPSync)UpdateOrganizationSyncSettings(ctx context.Context,db database.Store,settingsOrganizationSyncSettings)error {
3838
rlv:=s.Manager.Resolver(db)
3939
err:=s.SyncSettings.Organization.SetRuntimeValue(ctx,rlv,&settings)
4040
iferr!=nil {

‎coderd/runtimeconfig/resolver.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import (
1212
"github.com/coder/coder/v2/coderd/database"
1313
)
1414

15+
// NoopResolver implements the Resolver interface
16+
var_Resolver=&NoopResolver{}
17+
1518
// NoopResolver is a useful test device.
1619
typeNoopResolverstruct{}
1720

@@ -31,6 +34,9 @@ func (NoopResolver) DeleteRuntimeConfig(context.Context, string) error {
3134
returnErrEntryNotFound
3235
}
3336

37+
// StoreResolver implements the Resolver interface
38+
var_Resolver=&StoreResolver{}
39+
3440
// StoreResolver uses the database as the underlying store for runtime settings.
3541
typeStoreResolverstruct {
3642
dbStore

‎coderd/telemetry/telemetry_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ func TestTelemetry(t *testing.T) {
295295
org,err:=db.GetDefaultOrganization(ctx)
296296
require.NoError(t,err)
297297
sync:=idpsync.NewAGPLSync(testutil.Logger(t),runtimeconfig.NewManager(), idpsync.DeploymentSyncSettings{})
298-
err=sync.UpdateOrganizationSettings(ctx,db, idpsync.OrganizationSyncSettings{
298+
err=sync.UpdateOrganizationSyncSettings(ctx,db, idpsync.OrganizationSyncSettings{
299299
Field:"organizations",
300300
Mapping:map[string][]uuid.UUID{
301301
"first": {org.ID},

‎codersdk/idpsync.go‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ import (
1212
"golang.org/x/xerrors"
1313
)
1414

15+
// constraining to `uuid.UUID | string` here would be nice but `make gen` will
16+
// yell at you for it.
17+
typeIDPSyncMapping[ResourceIdType uuid.UUID|string]struct {
18+
// The IdP claim the user has
19+
Givenstring
20+
// The ID of the Coder resource the user should be added to
21+
GetsResourceIdType
22+
}
23+
1524
typeGroupSyncSettingsstruct {
1625
// Field is the name of the claim field that specifies what groups a user
1726
// should be in. If empty, no groups will be synced.
@@ -137,6 +146,26 @@ func (c *Client) PatchOrganizationIDPSyncSettings(ctx context.Context, req Organ
137146
returnresp,json.NewDecoder(res.Body).Decode(&resp)
138147
}
139148

149+
// If the same mapping is present in both Add and Remove, Remove will take presidence.
150+
typePatchOrganizationIDPSyncMappingRequeststruct {
151+
Add []IDPSyncMapping[uuid.UUID]
152+
Remove []IDPSyncMapping[uuid.UUID]
153+
}
154+
155+
func (c*Client)PatchOrganizationIDPSyncMapping(ctx context.Context,reqPatchOrganizationIDPSyncMappingRequest) (OrganizationSyncSettings,error) {
156+
res,err:=c.Request(ctx,http.MethodPatch,"/api/v2/settings/idpsync/organization/mapping",req)
157+
iferr!=nil {
158+
returnOrganizationSyncSettings{},xerrors.Errorf("make request: %w",err)
159+
}
160+
deferres.Body.Close()
161+
162+
ifres.StatusCode!=http.StatusOK {
163+
returnOrganizationSyncSettings{},ReadBodyAsError(res)
164+
}
165+
varrespOrganizationSyncSettings
166+
returnresp,json.NewDecoder(res.Body).Decode(&resp)
167+
}
168+
140169
func (c*Client)GetAvailableIDPSyncFields(ctx context.Context) ([]string,error) {
141170
res,err:=c.Request(ctx,http.MethodGet,"/api/v2/settings/idpsync/available-fields",nil)
142171
iferr!=nil {

‎docs/reference/api/enterprise.md‎

Lines changed: 66 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎docs/reference/api/schemas.md‎

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp