Documentation ¶
Index ¶
- Variables
- func InitAcessControlGuardian(store sqlstore.Store, ac accesscontrol.AccessControl, ...)
- func InitLegacyGuardian(store sqlstore.Store)
- func MockDashboardGuardian(mock *FakeDashboardGuardian)
- type AccessControlDashboardGuardian
- func (a *AccessControlDashboardGuardian) CanAdmin() (bool, error)
- func (a *AccessControlDashboardGuardian) CanCreate(folderID int64, isFolder bool) (bool, error)
- func (a *AccessControlDashboardGuardian) CanDelete() (bool, error)
- func (a *AccessControlDashboardGuardian) CanEdit() (bool, error)
- func (a *AccessControlDashboardGuardian) CanSave() (bool, error)
- func (a *AccessControlDashboardGuardian) CanView() (bool, error)
- func (a *AccessControlDashboardGuardian) CheckPermissionBeforeUpdate(permission models.PermissionType, updatePermissions []*models.DashboardAcl) (bool, error)
- func (a *AccessControlDashboardGuardian) GetACLWithoutDuplicates() ([]*models.DashboardAclInfoDTO, error)
- func (a *AccessControlDashboardGuardian) GetAcl() ([]*models.DashboardAclInfoDTO, error)
- func (a *AccessControlDashboardGuardian) GetHiddenACL(cfg *setting.Cfg) ([]*models.DashboardAcl, error)
- type DashboardGuardian
- type FakeDashboardGuardian
- func (g *FakeDashboardGuardian) CanAdmin() (bool, error)
- func (g *FakeDashboardGuardian) CanCreate(_ int64, _ bool) (bool, error)
- func (g *FakeDashboardGuardian) CanDelete() (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)
- type Provider
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 { panic("no guardian factory implementation provided") }
New factory for creating a new dashboard guardian instance When using access control this function is replaced on startup and the AccessControlDashboardGuardian is returned
Functions ¶
func InitAcessControlGuardian ¶
func InitAcessControlGuardian(store sqlstore.Store, ac accesscontrol.AccessControl, permissionsServices accesscontrol.PermissionsServices)
func InitLegacyGuardian ¶
Types ¶
type AccessControlDashboardGuardian ¶
type AccessControlDashboardGuardian struct {
// contains filtered or unexported fields
}
func NewAccessControlDashboardGuardian ¶
func NewAccessControlDashboardGuardian( ctx context.Context, dashboardId int64, user *models.SignedInUser, store sqlstore.Store, ac accesscontrol.AccessControl, permissionsServices accesscontrol.PermissionsServices, ) *AccessControlDashboardGuardian
func (*AccessControlDashboardGuardian) CanAdmin ¶
func (a *AccessControlDashboardGuardian) CanAdmin() (bool, error)
func (*AccessControlDashboardGuardian) CanCreate ¶
func (a *AccessControlDashboardGuardian) CanCreate(folderID int64, isFolder bool) (bool, error)
func (*AccessControlDashboardGuardian) CanDelete ¶
func (a *AccessControlDashboardGuardian) CanDelete() (bool, error)
func (*AccessControlDashboardGuardian) CanEdit ¶
func (a *AccessControlDashboardGuardian) CanEdit() (bool, error)
func (*AccessControlDashboardGuardian) CanSave ¶
func (a *AccessControlDashboardGuardian) CanSave() (bool, error)
func (*AccessControlDashboardGuardian) CanView ¶
func (a *AccessControlDashboardGuardian) CanView() (bool, error)
func (*AccessControlDashboardGuardian) CheckPermissionBeforeUpdate ¶
func (a *AccessControlDashboardGuardian) CheckPermissionBeforeUpdate(permission models.PermissionType, updatePermissions []*models.DashboardAcl) (bool, error)
func (*AccessControlDashboardGuardian) GetACLWithoutDuplicates ¶
func (a *AccessControlDashboardGuardian) GetACLWithoutDuplicates() ([]*models.DashboardAclInfoDTO, error)
func (*AccessControlDashboardGuardian) GetAcl ¶
func (a *AccessControlDashboardGuardian) GetAcl() ([]*models.DashboardAclInfoDTO, error)
GetAcl translate access control permissions to dashboard acl info
func (*AccessControlDashboardGuardian) GetHiddenACL ¶
func (a *AccessControlDashboardGuardian) GetHiddenACL(cfg *setting.Cfg) ([]*models.DashboardAcl, error)
type DashboardGuardian ¶
type DashboardGuardian interface { CanSave() (bool, error) CanEdit() (bool, error) CanView() (bool, error) CanAdmin() (bool, error) CanDelete() (bool, error) CanCreate(folderID int64, isFolder bool) (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) CanCreate ¶
func (g *FakeDashboardGuardian) CanCreate(_ int64, _ bool) (bool, error)
func (*FakeDashboardGuardian) CanDelete ¶
func (g *FakeDashboardGuardian) CanDelete() (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)
type Provider ¶
type Provider struct{}
func ProvideService ¶
func ProvideService(store *sqlstore.SQLStore, ac accesscontrol.AccessControl, permissionsServices accesscontrol.PermissionsServices, features featuremgmt.FeatureToggles) *Provider
Click to show internal directories.
Click to hide internal directories.