dashboard_acl.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package models
  2. import "time"
  3. type PermissionType int
  4. const (
  5. PERMISSION_EDIT PermissionType = 4
  6. PERMISSION_READ_ONLY_EDIT PermissionType = 2
  7. PERMISSION_VIEW PermissionType = 1
  8. )
  9. // Typed errors
  10. // var (
  11. // ErrDashboardPermissionAlreadyAdded = errors.New("A permission has ")
  12. // )
  13. // Dashboard ACL model
  14. type DashboardAcl struct {
  15. Id int64
  16. OrgId int64
  17. DashboardId int64
  18. Created time.Time
  19. Updated time.Time
  20. UserId int64
  21. UserGroupId int64
  22. Permissions PermissionType
  23. }
  24. //
  25. // COMMANDS
  26. //
  27. type AddOrUpdateDashboardPermissionCommand struct {
  28. DashboardId int64 `json:"dashboardId" binding:"Required"`
  29. OrgId int64 `json:"-"`
  30. UserId int64 `json:"userId"`
  31. UserGroupId int64 `json:"userGroupId"`
  32. PermissionType PermissionType `json:"permissionType" binding:"Required"`
  33. }
  34. //
  35. // QUERIES
  36. //
  37. type GetDashboardPermissionsQuery struct {
  38. DashboardId int64 `json:"dashboardId" binding:"Required"`
  39. Result []*DashboardAcl
  40. }