dashboard acl work

This commit is contained in:
Torkel Ödegaard
2017-06-21 14:11:16 -04:00
parent 43ffe826fa
commit fcc8557dbb
12 changed files with 136 additions and 113 deletions

View File

@@ -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)
}