func (self *LevelDbDatastore) ExecuteQuery(user common.User, database string, query *parser.SelectQuery, yield func(*protocol.Series) error, ringFilter func(database, series *string, time *int64) bool) error { seriesAndColumns := query.GetReferencedColumns() hasAccess := true for series, columns := range seriesAndColumns { if regex, ok := series.GetCompiledRegex(); ok { seriesNames := self.getSeriesForDbAndRegex(database, regex) for _, name := range seriesNames { if !user.HasReadAccess(name) { hasAccess = false continue } err := self.executeQueryForSeries(database, name, columns, query, yield, ringFilter) if err != nil { return err } } } else { if !user.HasReadAccess(series.Name) { hasAccess = false continue } err := self.executeQueryForSeries(database, series.Name, columns, query, yield, ringFilter) if err != nil { return err } } } if !hasAccess { return fmt.Errorf("You don't have permission to access one or more time series") } return nil }