feat(kv): enable reading from URM by user index (#17618)

pull/17753/head
George 2020-04-15 10:36:39 +01:00 committed by GitHub
parent bbfb460be5
commit 655f0df2d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 20 deletions

View File

@ -4,6 +4,8 @@
### Bug Fixes
1. [17618](https://github.com/influxdata/influxdb/pull/17618): Add index for URM by user ID to improve lookup performance
### UI Improvements
1. [17714](https://github.com/influxdata/influxdb/pull/17714): Cloud environments no longer render markdown images, for security reasons.

View File

@ -79,7 +79,7 @@ func NewService(log *zap.Logger, kv Store, configs ...ServiceConfig) *Service {
id, _ := urm.UserID.Encode()
return id, nil
},
)),
), WithIndexReadPathEnabled),
disableAuthorizationsForMaxPermissions: func(context.Context) bool {
return false
},
@ -115,18 +115,13 @@ func NewService(log *zap.Logger, kv Store, configs ...ServiceConfig) *Service {
s.clock = clock.New()
}
if s.Config.URMByUserIndexReadPathEnabled {
WithIndexReadPathEnabled(s.urmByUserIndex)
}
return s
}
// ServiceConfig allows us to configure Services
type ServiceConfig struct {
SessionLength time.Duration
Clock clock.Clock
URMByUserIndexReadPathEnabled bool
SessionLength time.Duration
Clock clock.Clock
}
// AutoMigrationStore is a Store which also describes whether or not

View File

@ -28,22 +28,10 @@ func TestBoltUserResourceMappingService(t *testing.T) {
influxdbtesting.UserResourceMappingService(initURMServiceFunc(NewTestBoltStore), t)
}
func TestBoltUserResourceMappingService_WithUserIndex(t *testing.T) {
influxdbtesting.UserResourceMappingService(initURMServiceFunc(NewTestBoltStore, kv.ServiceConfig{
URMByUserIndexReadPathEnabled: true,
}), t)
}
func TestInmemUserResourceMappingService(t *testing.T) {
influxdbtesting.UserResourceMappingService(initURMServiceFunc(NewTestBoltStore), t)
}
func TestInmemUserResourceMappingService_WithUserIndex(t *testing.T) {
influxdbtesting.UserResourceMappingService(initURMServiceFunc(NewTestBoltStore, kv.ServiceConfig{
URMByUserIndexReadPathEnabled: true,
}), t)
}
type userResourceMappingTestFunc func(influxdbtesting.UserResourceFields, *testing.T) (influxdb.UserResourceMappingService, func())
func initURMServiceFunc(storeFn func(*testing.T) (kv.Store, func(), error), confs ...kv.ServiceConfig) userResourceMappingTestFunc {