3148a918ce
DataSourcePermissions: Handle licensing properly for ds permissions (#59694)
* RBAC: add viewer grand if dspermissions enforcement is not enabled
* RBAC: Change permissions based on role prefix
* RBAC: Add option to for permission service to add a license middleware
* RBAC: Remove actions from query struct
(cherry picked from commit 6d1bcd9f40)
20 lines
355 B
Go
20 lines
355 B
Go
package resourcepermissions
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/grafana/grafana/pkg/models"
|
|
"github.com/grafana/grafana/pkg/web"
|
|
)
|
|
|
|
func disableMiddleware(shouldDisable bool) web.Handler {
|
|
return func(c *models.ReqContext) {
|
|
if shouldDisable {
|
|
c.Resp.WriteHeader(http.StatusNotFound)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
|
|
func nopMiddleware(c *models.ReqContext) {}
|