Documentation ¶
Index ¶
- Variables
- func MockDashboardGuardian(mock *FakeDashboardGuardian)
- type DashboardGuardian
- type FakeDashboardGuardian
- func (g *FakeDashboardGuardian) CanAdmin() (bool, error)
- func (g *FakeDashboardGuardian) CanEdit() (bool, error)
- func (g *FakeDashboardGuardian) CanSave() (bool, error)
- func (g *FakeDashboardGuardian) CanView() (bool, error)
- func (g *FakeDashboardGuardian) CheckPermissionBeforeUpdate(permission models.PermissionType, updatePermissions []*models.DashboardAcl) (bool, error)
- func (g *FakeDashboardGuardian) GetACLWithoutDuplicates() ([]*models.DashboardAclInfoDTO, error)
- func (g *FakeDashboardGuardian) GetAcl() ([]*models.DashboardAclInfoDTO, error)
- func (g *FakeDashboardGuardian) GetHiddenACL(cfg *setting.Cfg) ([]*models.DashboardAcl, error)
- func (g *FakeDashboardGuardian) HasPermission(permission models.PermissionType) (bool, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrGuardianPermissionExists = errors.New("permission already exists") ErrGuardianOverride = errors.New("you can only override a permission to be higher") )
View Source
var New = func(ctx context.Context, dashId int64, orgId int64, user *models.SignedInUser) DashboardGuardian { return &dashboardGuardianImpl{ user: user, dashId: dashId, orgId: orgId, log: log.New("dashboard.permissions"), ctx: ctx, } }
New factory for creating a new dashboard guardian instance
Functions ¶
Types ¶
type DashboardGuardian ¶
type DashboardGuardian interface { CanSave() (bool, error) CanEdit() (bool, error) CanView() (bool, error) CanAdmin() (bool, error) HasPermission(permission models.PermissionType) (bool, error) CheckPermissionBeforeUpdate(permission models.PermissionType, updatePermissions []*models.DashboardAcl) (bool, error) // GetAcl returns ACL. GetAcl() ([]*models.DashboardAclInfoDTO, error) // GetACLWithoutDuplicates returns ACL and strips any permission // that already has an inherited permission with higher or equal // permission. GetACLWithoutDuplicates() ([]*models.DashboardAclInfoDTO, error) GetHiddenACL(*setting.Cfg) ([]*models.DashboardAcl, error) }
DashboardGuardian to be used for guard against operations without access on dashboard and acl
type FakeDashboardGuardian ¶
type FakeDashboardGuardian struct { DashId int64 OrgId int64 User *models.SignedInUser CanSaveValue bool CanEditValue bool CanViewValue bool CanAdminValue bool HasPermissionValue bool CheckPermissionBeforeUpdateValue bool CheckPermissionBeforeUpdateError error GetAclValue []*models.DashboardAclInfoDTO GetHiddenAclValue []*models.DashboardAcl }
nolint:unused
func (*FakeDashboardGuardian) CanAdmin ¶
func (g *FakeDashboardGuardian) CanAdmin() (bool, error)
func (*FakeDashboardGuardian) CanEdit ¶
func (g *FakeDashboardGuardian) CanEdit() (bool, error)
func (*FakeDashboardGuardian) CanSave ¶
func (g *FakeDashboardGuardian) CanSave() (bool, error)
func (*FakeDashboardGuardian) CanView ¶
func (g *FakeDashboardGuardian) CanView() (bool, error)
func (*FakeDashboardGuardian) CheckPermissionBeforeUpdate ¶
func (g *FakeDashboardGuardian) CheckPermissionBeforeUpdate(permission models.PermissionType, updatePermissions []*models.DashboardAcl) (bool, error)
func (*FakeDashboardGuardian) GetACLWithoutDuplicates ¶
func (g *FakeDashboardGuardian) GetACLWithoutDuplicates() ([]*models.DashboardAclInfoDTO, error)
func (*FakeDashboardGuardian) GetAcl ¶
func (g *FakeDashboardGuardian) GetAcl() ([]*models.DashboardAclInfoDTO, error)
func (*FakeDashboardGuardian) GetHiddenACL ¶
func (g *FakeDashboardGuardian) GetHiddenACL(cfg *setting.Cfg) ([]*models.DashboardAcl, error)
func (*FakeDashboardGuardian) HasPermission ¶
func (g *FakeDashboardGuardian) HasPermission(permission models.PermissionType) (bool, error)
Click to show internal directories.
Click to hide internal directories.