WIP: Add or update Dashboard ACL
SQL Integration Tests for the guardian class too.
This commit is contained in:
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user