Commit e2900158 by Torkel Ödegaard

refactoring: renaming

parent aaf2a897
......@@ -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)
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment