mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Cfg: Move ViewersCanEdit into cfg (#64876)
move ViewersCanEdit into cfg
This commit is contained in:
@@ -83,9 +83,11 @@ func removeForceLoginParams(str string) string {
|
||||
return forceLoginParamsRegexp.ReplaceAllString(str, "")
|
||||
}
|
||||
|
||||
func EnsureEditorOrViewerCanEdit(c *contextmodel.ReqContext) {
|
||||
if !c.SignedInUser.HasRole(org.RoleEditor) && !setting.ViewersCanEdit {
|
||||
accessForbidden(c)
|
||||
func EnsureEditorOrViewerCanEdit(cfg *setting.Cfg) func(c *contextmodel.ReqContext) {
|
||||
return func(c *contextmodel.ReqContext) {
|
||||
if !c.SignedInUser.HasRole(org.RoleEditor) && !cfg.ViewersCanEdit {
|
||||
accessForbidden(c)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user