mirror of
https://github.com/grafana/grafana.git
synced 2025-01-16 11:42:35 -06:00
Access control: Add a role for provisioning admins (#33787)
This commit is contained in:
parent
baf80dad82
commit
1d15686bdf
@ -42,6 +42,10 @@ func (p RoleDTO) Role() Role {
|
|||||||
const (
|
const (
|
||||||
// Permission actions
|
// Permission actions
|
||||||
|
|
||||||
|
// Actions
|
||||||
|
// Provisioning actions
|
||||||
|
ActionProvisioningReload = "provisioning:reload"
|
||||||
|
|
||||||
// Users actions
|
// Users actions
|
||||||
ActionUsersRead = "users:read"
|
ActionUsersRead = "users:read"
|
||||||
ActionUsersWrite = "users:write"
|
ActionUsersWrite = "users:write"
|
||||||
@ -80,6 +84,9 @@ const (
|
|||||||
|
|
||||||
ScopeUsersSelf = "users:self"
|
ScopeUsersSelf = "users:self"
|
||||||
ScopeUsersAll = "users:*"
|
ScopeUsersAll = "users:*"
|
||||||
|
|
||||||
|
// Services Scopes
|
||||||
|
ScopeServicesAll = "service:*"
|
||||||
)
|
)
|
||||||
|
|
||||||
const RoleGrafanaAdmin = "Grafana Admin"
|
const RoleGrafanaAdmin = "Grafana Admin"
|
||||||
|
@ -124,6 +124,17 @@ var usersAdminEditRole = RoleDTO{
|
|||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var provisioningAdminRole = RoleDTO{
|
||||||
|
Name: provisioningAdmin,
|
||||||
|
Version: 1,
|
||||||
|
Permissions: []Permission{
|
||||||
|
{
|
||||||
|
Action: ActionProvisioningReload,
|
||||||
|
Scope: ScopeServicesAll,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
// PredefinedRoles provides a map of permission sets/roles which can be
|
// PredefinedRoles provides a map of permission sets/roles which can be
|
||||||
// assigned to a set of users. When adding a new resource protected by
|
// assigned to a set of users. When adding a new resource protected by
|
||||||
// Grafana access control the default permissions should be added to a
|
// Grafana access control the default permissions should be added to a
|
||||||
@ -139,6 +150,8 @@ var PredefinedRoles = map[string]RoleDTO{
|
|||||||
|
|
||||||
ldapAdminRead: ldapAdminReadRole,
|
ldapAdminRead: ldapAdminReadRole,
|
||||||
ldapAdminEdit: ldapAdminEditRole,
|
ldapAdminEdit: ldapAdminEditRole,
|
||||||
|
|
||||||
|
provisioningAdmin: provisioningAdminRole,
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -150,6 +163,8 @@ const (
|
|||||||
|
|
||||||
ldapAdminEdit = "grafana:roles:ldap:admin:edit"
|
ldapAdminEdit = "grafana:roles:ldap:admin:edit"
|
||||||
ldapAdminRead = "grafana:roles:ldap:admin:read"
|
ldapAdminRead = "grafana:roles:ldap:admin:read"
|
||||||
|
|
||||||
|
provisioningAdmin = "grafana:roles:provisioning:admin"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PredefinedRoleGrants specifies which organization roles are assigned
|
// PredefinedRoleGrants specifies which organization roles are assigned
|
||||||
@ -158,6 +173,7 @@ var PredefinedRoleGrants = map[string][]string{
|
|||||||
RoleGrafanaAdmin: {
|
RoleGrafanaAdmin: {
|
||||||
ldapAdminEdit,
|
ldapAdminEdit,
|
||||||
ldapAdminRead,
|
ldapAdminRead,
|
||||||
|
provisioningAdmin,
|
||||||
usersAdminEdit,
|
usersAdminEdit,
|
||||||
usersAdminRead,
|
usersAdminRead,
|
||||||
usersOrgEdit,
|
usersOrgEdit,
|
||||||
|
Loading…
Reference in New Issue
Block a user