浏览代码

refactoring: renaming

Torkel Ödegaard 8 年之前
父节点
当前提交
e290015887

+ 1 - 1
pkg/api/dashboard_acl.go

@@ -38,7 +38,7 @@ func PostDashboardAcl(c *middleware.Context, cmd m.SetDashboardAclCommand) Respo
 	cmd.DashboardId = dashId
 
 	if err := bus.Dispatch(&cmd); err != nil {
-		if err == m.ErrDashboardPermissionUserOrUserGroupEmpty {
+		if err == m.ErrDashboardAclInfoMissing {
 			return ApiError(409, err.Error(), err)
 		}
 		return ApiError(500, "Failed to create permission", err)

+ 9 - 9
pkg/models/dashboard_acl.go

@@ -24,21 +24,21 @@ func (p PermissionType) String() string {
 
 // Typed errors
 var (
-	ErrDashboardPermissionUserOrUserGroupEmpty = errors.New("User id and user group id cannot both be empty for a dashboard permission.")
+	ErrDashboardAclInfoMissing = errors.New("User id and user group id cannot both be empty for a dashboard permission.")
 )
 
 // Dashboard ACL model
 type DashboardAcl struct {
-	Id          int64 `json:"id"`
-	OrgId       int64 `json:"-"`
-	DashboardId int64 `json:"dashboardId"`
+	Id          int64
+	OrgId       int64
+	DashboardId int64
 
-	Created time.Time `json:"created"`
-	Updated time.Time `json:"updated"`
+	UserId      int64
+	UserGroupId int64
+	Permissions PermissionType
 
-	UserId      int64          `json:"userId"`
-	UserGroupId int64          `json:"userGroupId"`
-	Permissions PermissionType `json:"permissions"`
+	Created time.Time
+	Updated time.Time
 }
 
 type DashboardAclInfoDTO struct {

+ 1 - 1
pkg/services/sqlstore/dashboard_acl.go

@@ -17,7 +17,7 @@ func init() {
 func SetDashboardAcl(cmd *m.SetDashboardAclCommand) error {
 	return inTransaction(func(sess *DBSession) error {
 		if cmd.UserId == 0 && cmd.UserGroupId == 0 {
-			return m.ErrDashboardPermissionUserOrUserGroupEmpty
+			return m.ErrDashboardAclInfoMissing
 		}
 
 		if res, err := sess.Query("SELECT 1 from "+dialect.Quote("dashboard_acl")+" WHERE dashboard_id =? and (user_group_id=? or user_id=?)", cmd.DashboardId, cmd.UserGroupId, cmd.UserId); err != nil {

+ 1 - 1
pkg/services/sqlstore/dashboard_acl_test.go

@@ -22,7 +22,7 @@ func TestDashboardAclDataAccess(t *testing.T) {
 					DashboardId: savedFolder.Id,
 					Permissions: m.PERMISSION_EDIT,
 				})
-				So(err, ShouldEqual, m.ErrDashboardPermissionUserOrUserGroupEmpty)
+				So(err, ShouldEqual, m.ErrDashboardAclInfoMissing)
 			})
 
 			Convey("Given dashboard folder permission", func() {