mirror of
https://github.com/grafana/grafana.git
synced 2026-08-14 07:04:57 -05:00
Quota: Makes sure we provide the request context to the quota service (#21949)
It was missing for ldap_login which means that the first signup failed for users with LDAP+quota enabled. There's also potential cases where we can't provide a request context (background jobs) which is also covered, but needs a refactoring.
This commit is contained in:
@@ -23,7 +23,12 @@ func (qs *QuotaService) QuotaReached(c *m.ReqContext, target string) (bool, erro
|
||||
if !setting.Quota.Enabled {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// No request context means this is a background service, like LDAP Background Sync.
|
||||
// TODO: we should replace the req context with a more limited interface or struct,
|
||||
// something that we could easily provide from background jobs.
|
||||
if c == nil {
|
||||
return false, nil
|
||||
}
|
||||
// get the list of scopes that this target is valid for. Org, User, Global
|
||||
scopes, err := m.GetQuotaScopes(target)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user