mirror of
https://github.com/grafana/grafana.git
synced 2024-11-27 11:20:27 -06:00
52 lines
1.0 KiB
Go
52 lines
1.0 KiB
Go
|
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
|
||
|
}
|