Documentation ¶
Index ¶
- Variables
- func PermissionMatchesSearchOptions(permission accesscontrol.Permission, ...) bool
- type AccessControl
- type GetPermissionsFn
- type Service
- func (s *Service) ClearUserPermissionCache(user identity.Requester)
- func (s *Service) DeclareFixedRoles(registrations ...accesscontrol.RoleRegistration) error
- func (s *Service) DeclarePluginRoles(ctx context.Context, ID, name string, regs []plugins.RoleRegistration) error
- func (s *Service) DeleteExternalServiceRole(ctx context.Context, externalServiceID string) error
- func (s *Service) DeleteTeamPermissions(ctx context.Context, orgID int64, teamID int64) error
- func (s *Service) DeleteUserPermissions(ctx context.Context, orgID int64, userID int64) error
- func (s *Service) GetRoleByName(ctx context.Context, orgID int64, roleName string) (*accesscontrol.RoleDTO, error)
- func (s *Service) GetUsageStats(_ context.Context) map[string]any
- func (s *Service) GetUserPermissions(ctx context.Context, user identity.Requester, options accesscontrol.Options) ([]accesscontrol.Permission, error)
- func (s *Service) RegisterFixedRoles(ctx context.Context) error
- func (s *Service) SaveExternalServiceRole(ctx context.Context, cmd accesscontrol.SaveExternalServiceRoleCommand) error
- func (s *Service) SearchUserPermissions(ctx context.Context, orgID int64, searchOptions accesscontrol.SearchOptions) ([]accesscontrol.Permission, error)
- func (s *Service) SearchUsersPermissions(ctx context.Context, usr identity.Requester, ...) (map[int64][]accesscontrol.Permission, error)
- func (*Service) SyncUserRoles(ctx context.Context, orgID int64, cmd accesscontrol.SyncUserRolesCommand) error
Constants ¶
This section is empty.
Variables ¶
View Source
var OSSRolesPrefixes = []string{accesscontrol.ManagedRolePrefix, accesscontrol.ExternalServiceRolePrefix}
View Source
dashboards.ActionFoldersRead, Scope: dashboards.ScopeFoldersProvider.GetResourceScopeUID(folder.SharedWithMeFolderUID), }Action:
Functions ¶
func PermissionMatchesSearchOptions ¶
func PermissionMatchesSearchOptions(permission accesscontrol.Permission, searchOptions *accesscontrol.SearchOptions) bool
Types ¶
type AccessControl ¶
type AccessControl struct {
// contains filtered or unexported fields
}
func ProvideAccessControl ¶
func ProvideAccessControl(features featuremgmt.FeatureToggles) *AccessControl
func (*AccessControl) Evaluate ¶
func (a *AccessControl) Evaluate(ctx context.Context, user identity.Requester, evaluator accesscontrol.Evaluator) (bool, error)
func (*AccessControl) RegisterScopeAttributeResolver ¶
func (a *AccessControl) RegisterScopeAttributeResolver(prefix string, resolver accesscontrol.ScopeAttributeResolver)
type GetPermissionsFn ¶
type GetPermissionsFn = func() ([]accesscontrol.Permission, error)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the service implementing role based access control.
func ProvideOSSService ¶
func ProvideOSSService(cfg *setting.Cfg, store accesscontrol.Store, actionResolver accesscontrol.ActionResolver, cache *localcache.CacheService, features featuremgmt.FeatureToggles, tracer tracing.Tracer) *Service
func ProvideService ¶
func ProvideService(cfg *setting.Cfg, db db.DB, routeRegister routing.RouteRegister, cache *localcache.CacheService, accessControl accesscontrol.AccessControl, actionResolver accesscontrol.ActionResolver, features featuremgmt.FeatureToggles, tracer tracing.Tracer) (*Service, error)
func (*Service) ClearUserPermissionCache ¶
func (*Service) DeclareFixedRoles ¶
func (s *Service) DeclareFixedRoles(registrations ...accesscontrol.RoleRegistration) error
DeclareFixedRoles allow the caller to declare, to the service, fixed roles and their assignments to organization roles ("Viewer", "Editor", "Admin") or "Grafana Admin"
func (*Service) DeclarePluginRoles ¶
func (s *Service) DeclarePluginRoles(ctx context.Context, ID, name string, regs []plugins.RoleRegistration) error
DeclarePluginRoles allow the caller to declare, to the service, plugin roles and their assignments to organization roles ("Viewer", "Editor", "Admin") or "Grafana Admin"
func (*Service) DeleteExternalServiceRole ¶
func (*Service) DeleteTeamPermissions ¶
func (*Service) DeleteUserPermissions ¶
func (*Service) GetRoleByName ¶
func (*Service) GetUserPermissions ¶
func (s *Service) GetUserPermissions(ctx context.Context, user identity.Requester, options accesscontrol.Options) ([]accesscontrol.Permission, error)
GetUserPermissions returns user permissions based on built-in roles
func (*Service) RegisterFixedRoles ¶
RegisterFixedRoles registers all declared roles in RAM
func (*Service) SaveExternalServiceRole ¶
func (s *Service) SaveExternalServiceRole(ctx context.Context, cmd accesscontrol.SaveExternalServiceRoleCommand) error
func (*Service) SearchUserPermissions ¶
func (s *Service) SearchUserPermissions(ctx context.Context, orgID int64, searchOptions accesscontrol.SearchOptions) ([]accesscontrol.Permission, error)
func (*Service) SearchUsersPermissions ¶
func (s *Service) SearchUsersPermissions(ctx context.Context, usr identity.Requester, options accesscontrol.SearchOptions) (map[int64][]accesscontrol.Permission, error)
TODO potential changes needed here? SearchUsersPermissions returns all users' permissions filtered by action prefixes
func (*Service) SyncUserRoles ¶
func (*Service) SyncUserRoles(ctx context.Context, orgID int64, cmd accesscontrol.SyncUserRolesCommand) error
Click to show internal directories.
Click to hide internal directories.