WIP: Add or update Dashboard ACL

SQL Integration Tests for the guardian class too.
This commit is contained in:
Daniel Lee
2017-06-12 15:49:09 +02:00
parent 3785894b40
commit 97c13b77bf
7 changed files with 236 additions and 13 deletions
+51
View File
@@ -0,0 +1,51 @@
package models
import "time"
type PermissionType int
const (
PERMISSION_EDIT PermissionType = 4
PERMISSION_READ_ONLY_EDIT PermissionType = 2
PERMISSION_VIEW PermissionType = 1
)
// Typed errors
// var (
// ErrDashboardPermissionAlreadyAdded = errors.New("A permission has ")
// )
// Dashboard ACL model
type DashboardAcl struct {
Id int64
OrgId int64
DashboardId int64
Created time.Time
Updated time.Time
UserId int64
UserGroupId int64
Permissions PermissionType
}
//
// COMMANDS
//
type AddOrUpdateDashboardPermissionCommand struct {
DashboardId int64 `json:"dashboardId" binding:"Required"`
OrgId int64 `json:"-"`
UserId int64 `json:"userId"`
UserGroupId int64 `json:"userGroupId"`
PermissionType PermissionType `json:"permissionType" binding:"Required"`
}
//
// QUERIES
//
type GetDashboardPermissionsQuery struct {
DashboardId int64 `json:"dashboardId" binding:"Required"`
Result []*DashboardAcl
}
+1 -8
View File
@@ -18,14 +18,6 @@ var (
ErrDashboardTitleEmpty = errors.New("Dashboard title cannot be empty")
)
type PermissionType int
const (
PERMISSION_EDIT PermissionType = 4
PERMISSION_READ_ONLY_EDIT PermissionType = 2
PERMISSION_VIEW PermissionType = 1
)
type UpdatePluginDashboardError struct {
PluginId string
}
@@ -57,6 +49,7 @@ type Dashboard struct {
CreatedBy int64
ParentId int64
IsFolder bool
HasAcl bool
Title string
Data *simplejson.Json