File tree 1 file changed +0
-24
lines changed 1 file changed +0
-24
lines changed Original file line number Diff line number Diff line change @@ -374,36 +374,12 @@ func (api *API) patchOrganizationIDPSyncMapping(rw http.ResponseWriter, r *http.
374
374
}
375
375
376
376
// Remove entries
377
-
378
- // Option 1: the way I was already doing it
379
- for _ , mapping := range req .Remove {
380
- for i , it := range newMapping [mapping .Given ] {
381
- if it == mapping .Gets {
382
- newMapping [mapping .Given ] = append (newMapping [mapping .Given ][:i ], newMapping [mapping .Given ][i + 1 :]... )
383
- }
384
- }
385
- }
386
-
387
- // Option 2: the way you suggested on the PR
388
377
for _ , mapping := range req .Remove {
389
378
newMapping [mapping .Given ] = slices .DeleteFunc (newMapping [mapping .Given ], func (u uuid.UUID ) bool {
390
379
return u == mapping .Gets
391
380
})
392
381
}
393
382
394
- // Option 3: this "optimal" but comparatively very noisey and dense version
395
- // Create a map[key][]thingsToRemove
396
- removeMap := make (map [string ][]uuid.UUID )
397
- for _ , mapping := range req .Remove {
398
- removeMap [mapping .Given ] = append (removeMap [mapping .Given ], mapping .Gets )
399
- }
400
- // Use `DeleteFunc` to remove anything from the `newMapping` present in `removeMap`
401
- for given , toRemove := range removeMap {
402
- newMapping [given ] = slices .DeleteFunc (newMapping [given ], func (id uuid.UUID ) bool {
403
- return slices .Contains (toRemove , id )
404
- })
405
- }
406
-
407
383
settings = idpsync.OrganizationSyncSettings {
408
384
Field : existing .Field ,
409
385
Mapping : newMapping ,
You can’t perform that action at this time.
0 commit comments