Merge pull request #5787 from chris-ramon/handler-query-authorizer

Improvement on `run.NewServer` related to `meta.QueryAuthorizer`.
pull/5803/merge
Jason Wilder 2016-02-23 11:11:56 -07:00
commit 92ae2a0e2d
3 changed files with 8 additions and 0 deletions

View File

@ -41,6 +41,7 @@
- [#5716](https://github.com/influxdata/influxdb/pull/5716): models: improve handling of points with empty field names or with no fields.
- [#5719](https://github.com/influxdata/influxdb/issues/5719): Fix cache not deduplicating points
- [#5754](https://github.com/influxdata/influxdb/issues/5754): Adding a node as meta only results in a data node also being registered
- [#5787](https://github.com/influxdata/influxdb/pull/5787): HTTP: Add QueryAuthorizer instance to httpd services handler. @chris-ramon
## v0.10.1 [2016-02-18]

View File

@ -289,6 +289,7 @@ func (s *Server) appendHTTPDService(c httpd.Config) {
}
srv := httpd.NewService(c)
srv.Handler.MetaClient = s.MetaClient
srv.Handler.QueryAuthorizer = meta.NewQueryAuthorizer(s.MetaClient)
srv.Handler.QueryExecutor = s.QueryExecutor
srv.Handler.PointsWriter = s.PointsWriter
srv.Handler.Version = s.buildInfo.Version

View File

@ -10,6 +10,12 @@ type QueryAuthorizer struct {
Client *Client
}
func NewQueryAuthorizer(c *Client) *QueryAuthorizer {
return &QueryAuthorizer{
Client: c,
}
}
// AuthorizeQuery authorizes u to execute q on database.
// Database can be "" for queries that do not require a database.
// If no user is provided it will return an error unless the query's first statement is to create