mirror of
https://github.com/grafana/grafana.git
synced 2026-09-05 04:40:13 -05:00
Rename Acl to ACL (#52342)
* Rename Acl to ACL * Fix yaml files * Add xorm tags and fix test
This commit is contained in:
@@ -28,12 +28,12 @@ func (hs *HTTPServer) GetFolderPermissionList(c *models.ReqContext) response.Res
|
||||
return apierrors.ToFolderErrorResponse(dashboards.ErrFolderAccessDenied)
|
||||
}
|
||||
|
||||
acl, err := g.GetAcl()
|
||||
acl, err := g.GetACL()
|
||||
if err != nil {
|
||||
return response.Error(500, "Failed to get folder permissions", err)
|
||||
}
|
||||
|
||||
filteredAcls := make([]*models.DashboardAclInfoDTO, 0, len(acl))
|
||||
filteredACLs := make([]*models.DashboardACLInfoDTO, 0, len(acl))
|
||||
for _, perm := range acl {
|
||||
if perm.UserId > 0 && dtos.IsHiddenUser(perm.UserLogin, c.SignedInUser, hs.Cfg) {
|
||||
continue
|
||||
@@ -52,14 +52,14 @@ func (hs *HTTPServer) GetFolderPermissionList(c *models.ReqContext) response.Res
|
||||
perm.Url = models.GetDashboardFolderUrl(perm.IsFolder, perm.Uid, perm.Slug)
|
||||
}
|
||||
|
||||
filteredAcls = append(filteredAcls, perm)
|
||||
filteredACLs = append(filteredACLs, perm)
|
||||
}
|
||||
|
||||
return response.JSON(http.StatusOK, filteredAcls)
|
||||
return response.JSON(http.StatusOK, filteredACLs)
|
||||
}
|
||||
|
||||
func (hs *HTTPServer) UpdateFolderPermissions(c *models.ReqContext) response.Response {
|
||||
apiCmd := dtos.UpdateDashboardAclCommand{}
|
||||
apiCmd := dtos.UpdateDashboardACLCommand{}
|
||||
if err := web.Bind(c.Req, &apiCmd); err != nil {
|
||||
return response.Error(http.StatusBadRequest, "bad request data", err)
|
||||
}
|
||||
@@ -82,9 +82,9 @@ func (hs *HTTPServer) UpdateFolderPermissions(c *models.ReqContext) response.Res
|
||||
return apierrors.ToFolderErrorResponse(dashboards.ErrFolderAccessDenied)
|
||||
}
|
||||
|
||||
var items []*models.DashboardAcl
|
||||
var items []*models.DashboardACL
|
||||
for _, item := range apiCmd.Items {
|
||||
items = append(items, &models.DashboardAcl{
|
||||
items = append(items, &models.DashboardACL{
|
||||
OrgID: c.OrgId,
|
||||
DashboardID: folder.Id,
|
||||
UserID: item.UserID,
|
||||
@@ -116,7 +116,7 @@ func (hs *HTTPServer) UpdateFolderPermissions(c *models.ReqContext) response.Res
|
||||
}
|
||||
|
||||
if !hs.AccessControl.IsDisabled() {
|
||||
old, err := g.GetAcl()
|
||||
old, err := g.GetACL()
|
||||
if err != nil {
|
||||
return response.Error(500, "Error while checking dashboard permissions", err)
|
||||
}
|
||||
@@ -127,14 +127,14 @@ func (hs *HTTPServer) UpdateFolderPermissions(c *models.ReqContext) response.Res
|
||||
}
|
||||
|
||||
if err := hs.DashboardService.UpdateDashboardACL(c.Req.Context(), folder.Id, items); err != nil {
|
||||
if errors.Is(err, models.ErrDashboardAclInfoMissing) {
|
||||
err = models.ErrFolderAclInfoMissing
|
||||
if errors.Is(err, models.ErrDashboardACLInfoMissing) {
|
||||
err = models.ErrFolderACLInfoMissing
|
||||
}
|
||||
if errors.Is(err, models.ErrDashboardPermissionDashboardEmpty) {
|
||||
err = models.ErrFolderPermissionFolderEmpty
|
||||
}
|
||||
|
||||
if errors.Is(err, models.ErrFolderAclInfoMissing) || errors.Is(err, models.ErrFolderPermissionFolderEmpty) {
|
||||
if errors.Is(err, models.ErrFolderACLInfoMissing) || errors.Is(err, models.ErrFolderPermissionFolderEmpty) {
|
||||
return response.Error(409, err.Error(), err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user