Chore: get user from appcontext rather than store utility (#59926)

user from appcontext
This commit is contained in:
Ryan McKinley
2022-12-07 07:38:23 -08:00
committed by GitHub
parent e8ed79873a
commit d036225f7b
9 changed files with 31 additions and 51 deletions
+6 -3
View File
@@ -6,9 +6,9 @@ import (
"sync"
"time"
"github.com/grafana/grafana/pkg/infra/appcontext"
"github.com/grafana/grafana/pkg/plugins"
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/services/store"
"github.com/grafana/grafana/pkg/tsdb/grafanads"
)
@@ -122,9 +122,12 @@ func (c *dsCache) getDS(ctx context.Context, uid string) (*dsVal, error) {
}
}
orgID := store.UserFromContext(ctx).OrgID
usr, err := appcontext.User(ctx)
if err != nil {
return nil, nil // no user
}
v, ok := c.cache[orgID]
v, ok := c.cache[usr.OrgID]
if !ok {
return nil, nil // org not found
}