mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Access control: Redirect non-API calls (#41100)
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/grafana/grafana/pkg/models"
|
"github.com/grafana/grafana/pkg/models"
|
||||||
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||||
|
"github.com/grafana/grafana/pkg/setting"
|
||||||
"github.com/grafana/grafana/pkg/util"
|
"github.com/grafana/grafana/pkg/util"
|
||||||
"github.com/grafana/grafana/pkg/web"
|
"github.com/grafana/grafana/pkg/web"
|
||||||
)
|
)
|
||||||
@@ -46,6 +47,12 @@ func Deny(c *models.ReqContext, evaluator accesscontrol.Evaluator, err error) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !c.IsApiRequest() {
|
||||||
|
// TODO(emil): I'd like to show a message after this redirect, not sure how that can be done?
|
||||||
|
c.Redirect(setting.AppSubUrl + "/")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// If the user triggers an error in the access control system, we
|
// If the user triggers an error in the access control system, we
|
||||||
// don't want the user to be aware of that, so the user gets the
|
// don't want the user to be aware of that, so the user gets the
|
||||||
// same information from the system regardless of if it's an
|
// same information from the system regardless of if it's an
|
||||||
|
Reference in New Issue
Block a user