mirror of
https://github.com/grafana/grafana.git
synced 2026-08-14 07:04:57 -05:00
AuthN: User Quota (#61540)
* remove reqContext from quota checks in login * add guards for nil ScopeParams
This commit is contained in:
@@ -161,7 +161,7 @@ func (ss *sqlxStore) Count(ctx context.Context, scopeParams *quota.ScopeParamete
|
||||
u.Set(tag, r.Count)
|
||||
}
|
||||
|
||||
if scopeParams.OrgID != 0 {
|
||||
if scopeParams != nil && scopeParams.OrgID != 0 {
|
||||
if err := ss.sess.Get(ctx, &r, `SELECT COUNT(*) AS count FROM api_key WHERE org_id = ?`, scopeParams.OrgID); err != nil {
|
||||
return u, err
|
||||
} else {
|
||||
|
||||
@@ -200,7 +200,7 @@ func (ss *sqlStore) Count(ctx context.Context, scopeParams *quota.ScopeParameter
|
||||
u.Set(tag, r.Count)
|
||||
}
|
||||
|
||||
if scopeParams.OrgID != 0 {
|
||||
if scopeParams != nil && scopeParams.OrgID != 0 {
|
||||
if err := ss.db.WithDbSession(ctx, func(sess *sqlstore.DBSession) error {
|
||||
rawSQL := "SELECT COUNT(*) AS count FROM api_key WHERE org_id = ?"
|
||||
if _, err := sess.SQL(rawSQL, scopeParams.OrgID).Get(&r); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user