Merge pull request #17285 from influxdata/la/fix-label-service
fix(http): make label service authorized by defaultpull/17292/head
commit
04b86df3be
|
@ -119,6 +119,7 @@ func NewAPIHandler(b *APIBackend, opts ...APIHandlerOptFn) *APIHandler {
|
|||
|
||||
noAuthUserResourceMappingService := b.UserResourceMappingService
|
||||
b.UserResourceMappingService = authorizer.NewURMService(b.OrgLookupService, b.UserResourceMappingService)
|
||||
b.LabelService = authorizer.NewLabelServiceWithOrg(b.LabelService, b.OrgLookupService)
|
||||
|
||||
h.Mount("/api/v2", serveLinksHandler(b.HTTPErrorHandler))
|
||||
|
||||
|
@ -128,7 +129,6 @@ func NewAPIHandler(b *APIBackend, opts ...APIHandlerOptFn) *APIHandler {
|
|||
|
||||
bucketBackend := NewBucketBackend(b.Logger.With(zap.String("handler", "bucket")), b)
|
||||
bucketBackend.BucketService = authorizer.NewBucketService(b.BucketService, noAuthUserResourceMappingService)
|
||||
bucketBackend.LabelService = authorizer.NewLabelServiceWithOrg(b.LabelService, b.OrgLookupService)
|
||||
h.Mount(prefixBuckets, NewBucketHandler(b.Logger, bucketBackend))
|
||||
|
||||
checkBackend := NewCheckBackend(b.Logger.With(zap.String("handler", "check")), b)
|
||||
|
@ -146,14 +146,13 @@ func NewAPIHandler(b *APIBackend, opts ...APIHandlerOptFn) *APIHandler {
|
|||
h.Mount(prefixDelete, NewDeleteHandler(b.Logger, deleteBackend))
|
||||
|
||||
documentBackend := NewDocumentBackend(b.Logger.With(zap.String("handler", "document")), b)
|
||||
documentBackend.LabelService = authorizer.NewLabelServiceWithOrg(b.LabelService, b.OrgLookupService)
|
||||
documentBackend.DocumentService = authorizer.NewDocumentService(b.DocumentService)
|
||||
h.Mount(prefixDocuments, NewDocumentHandler(documentBackend))
|
||||
|
||||
fluxBackend := NewFluxBackend(b.Logger.With(zap.String("handler", "query")), b)
|
||||
h.Mount(prefixQuery, NewFluxHandler(b.Logger, fluxBackend))
|
||||
|
||||
h.Mount(prefixLabels, NewLabelHandler(b.Logger, authorizer.NewLabelServiceWithOrg(b.LabelService, b.OrgLookupService), b.HTTPErrorHandler))
|
||||
h.Mount(prefixLabels, NewLabelHandler(b.Logger, b.LabelService, b.HTTPErrorHandler))
|
||||
|
||||
notificationEndpointBackend := NewNotificationEndpointBackend(b.Logger.With(zap.String("handler", "notificationEndpoint")), b)
|
||||
notificationEndpointBackend.NotificationEndpointService = authorizer.NewNotificationEndpointService(b.NotificationEndpointService,
|
||||
|
@ -168,7 +167,6 @@ func NewAPIHandler(b *APIBackend, opts ...APIHandlerOptFn) *APIHandler {
|
|||
orgBackend := NewOrgBackend(b.Logger.With(zap.String("handler", "org")), b)
|
||||
orgBackend.OrganizationService = authorizer.NewOrgService(b.OrganizationService)
|
||||
orgBackend.SecretService = authorizer.NewSecretService(b.SecretService)
|
||||
orgBackend.LabelService = authorizer.NewLabelServiceWithOrg(b.LabelService, b.OrgLookupService)
|
||||
h.Mount(prefixOrganizations, NewOrgHandler(b.Logger, orgBackend))
|
||||
|
||||
scraperBackend := NewScraperBackend(b.Logger.With(zap.String("handler", "scraper")), b)
|
||||
|
|
|
@ -124,7 +124,7 @@ func NewCheckHandler(log *zap.Logger, b *CheckBackend) *CheckHandler {
|
|||
HTTPErrorHandler: b.HTTPErrorHandler,
|
||||
log: b.log.With(zap.String("handler", "label")),
|
||||
LabelService: b.LabelService,
|
||||
ResourceType: influxdb.TelegrafsResourceType,
|
||||
ResourceType: influxdb.ChecksResourceType,
|
||||
}
|
||||
h.HandlerFunc("GET", checksIDLabelsPath, newGetLabelsHandler(labelBackend))
|
||||
h.HandlerFunc("POST", checksIDLabelsPath, newPostLabelHandler(labelBackend))
|
||||
|
|
|
@ -119,7 +119,7 @@ func NewNotificationEndpointHandler(log *zap.Logger, b *NotificationEndpointBack
|
|||
HTTPErrorHandler: b.HTTPErrorHandler,
|
||||
log: b.log.With(zap.String("handler", "label")),
|
||||
LabelService: b.LabelService,
|
||||
ResourceType: influxdb.TelegrafsResourceType,
|
||||
ResourceType: influxdb.NotificationEndpointResourceType,
|
||||
}
|
||||
h.HandlerFunc("GET", notificationEndpointsIDLabelsPath, newGetLabelsHandler(labelBackend))
|
||||
h.HandlerFunc("POST", notificationEndpointsIDLabelsPath, newPostLabelHandler(labelBackend))
|
||||
|
|
|
@ -132,7 +132,7 @@ func NewNotificationRuleHandler(log *zap.Logger, b *NotificationRuleBackend) *No
|
|||
HTTPErrorHandler: b.HTTPErrorHandler,
|
||||
log: b.log.With(zap.String("handler", "label")),
|
||||
LabelService: b.LabelService,
|
||||
ResourceType: influxdb.TelegrafsResourceType,
|
||||
ResourceType: influxdb.NotificationRuleResourceType,
|
||||
}
|
||||
h.HandlerFunc("GET", notificationRulesIDLabelsPath, newGetLabelsHandler(labelBackend))
|
||||
h.HandlerFunc("POST", notificationRulesIDLabelsPath, newPostLabelHandler(labelBackend))
|
||||
|
|
Loading…
Reference in New Issue