[v9.3.x] DataSourcePermissions: Handle licensing properly for ds permissions (#59709)
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)
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
This commit is contained in:
co-authored by
Karl Persson
parent
a271e24b3d
commit
04fb50f8cc
@@ -35,16 +35,11 @@ func (s *AccessControlStore) GetUserPermissions(ctx context.Context, query acces
|
||||
INNER JOIN role ON role.id = permission.role_id
|
||||
` + filter
|
||||
|
||||
if len(query.Actions) > 0 {
|
||||
q += " WHERE permission.action IN("
|
||||
if len(query.Actions) > 0 {
|
||||
q += "?" + strings.Repeat(",?", len(query.Actions)-1)
|
||||
}
|
||||
q += ")"
|
||||
for _, a := range query.Actions {
|
||||
params = append(params, a)
|
||||
}
|
||||
if query.RolePrefix != "" {
|
||||
q += " WHERE role.name LIKE ?"
|
||||
params = append(params, query.RolePrefix+"%")
|
||||
}
|
||||
|
||||
if err := sess.SQL(q, params...).Find(&result); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user