mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
dashboard acl work
This commit is contained in:
@@ -24,37 +24,6 @@ func GetDashboardAclList(c *middleware.Context) Response {
|
||||
}
|
||||
|
||||
list := query.Result
|
||||
hasViewRoleAcl := false
|
||||
hasEditRoleAcl := false
|
||||
|
||||
for _, item := range list {
|
||||
if item.Role == m.ROLE_EDITOR {
|
||||
hasEditRoleAcl = true
|
||||
}
|
||||
if item.Role == m.ROLE_VIEWER {
|
||||
hasViewRoleAcl = true
|
||||
}
|
||||
}
|
||||
|
||||
if !hasEditRoleAcl {
|
||||
tmpList := append([]*m.DashboardAclInfoDTO{}, &m.DashboardAclInfoDTO{
|
||||
Id: 0,
|
||||
Role: m.ROLE_EDITOR,
|
||||
Permissions: m.PERMISSION_EDIT,
|
||||
PermissionName: "Edit",
|
||||
})
|
||||
list = append(tmpList, list...)
|
||||
}
|
||||
if !hasViewRoleAcl {
|
||||
tmpList := append([]*m.DashboardAclInfoDTO{}, &m.DashboardAclInfoDTO{
|
||||
Id: 0,
|
||||
Role: m.ROLE_VIEWER,
|
||||
Permissions: m.PERMISSION_VIEW,
|
||||
PermissionName: "View",
|
||||
})
|
||||
list = append(tmpList, list...)
|
||||
}
|
||||
|
||||
return Json(200, list)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user