mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 04:09:17 +08:00
Access control: Basic structure and functionality behind feature toggle (#31893)
Co-authored-by: Alexander Zobnin <alexander.zobnin@grafana.com> Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com> Co-authored-by: Arve Knudsen <arve.knudsen@grafana.com> Co-authored-by: Marcus Efraimsson <marcus.efraimsson@grafana.com>
This commit is contained in:
@ -38,6 +38,17 @@ func (r RoleType) Includes(other RoleType) bool {
|
||||
return r == other
|
||||
}
|
||||
|
||||
func (r RoleType) Children() []RoleType {
|
||||
switch r {
|
||||
case ROLE_ADMIN:
|
||||
return []RoleType{ROLE_EDITOR, ROLE_VIEWER}
|
||||
case ROLE_EDITOR:
|
||||
return []RoleType{ROLE_VIEWER}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func (r *RoleType) UnmarshalJSON(data []byte) error {
|
||||
var str string
|
||||
err := json.Unmarshal(data, &str)
|
||||
|
Reference in New Issue
Block a user