Documentation
¶
Index ¶
- Variables
- type HTTPHandler
- type Observer
- type Repository
- func (r *Repository) DeleteUserData(ctx context.Context, userID ids.UserID) error
- func (r *Repository) EnsureUserSettings(ctx context.Context, userID ids.UserID) error
- func (r *Repository) GetAllUserHostGrants(ctx context.Context) ([]UserHostGrant, error)
- func (r *Repository) GetAllUserHostSettings(ctx context.Context) ([]UserHostSetting, error)
- func (r *Repository) SetUserAccess(ctx context.Context, userID ids.UserID, bypassHostCheck bool, ...) error
- type Service
- func (s *Service) AddObserver(o Observer)
- func (s *Service) GetAllUserHostAccess(ctx context.Context) ([]policy.UserHostAccess, error)
- func (s *Service) OnUserEvent(ctx context.Context, event auth.UserEvent)
- func (s *Service) SetUserAccess(ctx context.Context, userID ids.UserID, bypassHostCheck bool, ...) error
- type UserHostGrant
- type UserHostSetting
Constants ¶
This section is empty.
Variables ¶
var (
ErrReferenceNotFound = errors.New("referenced entity not found")
)
Functions ¶
This section is empty.
Types ¶
type HTTPHandler ¶
type HTTPHandler struct {
// contains filtered or unexported fields
}
func NewHTTPHandler ¶
func NewHTTPHandler(service *Service, logger *slog.Logger) *HTTPHandler
func (*HTTPHandler) SetUserAccess ¶
func (h *HTTPHandler) SetUserAccess( ctx context.Context, req httpapi.SetUserAccessRequestObject, ) (httpapi.SetUserAccessResponseObject, error)
type Observer ¶
Observer is implemented by any component that must react when user host-access grants change (e.g. policy.Service refreshing its cache).
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(db *database.DB) *Repository
func (*Repository) DeleteUserData ¶
func (*Repository) EnsureUserSettings ¶
func (*Repository) GetAllUserHostGrants ¶
func (r *Repository) GetAllUserHostGrants(ctx context.Context) ([]UserHostGrant, error)
GetAllUserHostGrants resolves every (user, fqdn) pair reachable through user_allowed_host_groups → host_group_members → hosts.
NOTE: this query intentionally crosses into the hosts domain tables (hosts, host_group_members), which violates the cross-domain-queries pattern (docs/patterns/backend/cross-domain-queries.md). It is kept here because this data is tightly coupled to the policy cache lifecycle. If this query grows or is reused outside of cache population, move it to internal/queries/.
func (*Repository) GetAllUserHostSettings ¶
func (r *Repository) GetAllUserHostSettings(ctx context.Context) ([]UserHostSetting, error)
func (*Repository) SetUserAccess ¶
func (r *Repository) SetUserAccess(ctx context.Context, userID ids.UserID, bypassHostCheck bool, groupIDs []ids.HostGroupID) error
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) AddObserver ¶
func (*Service) GetAllUserHostAccess ¶
GetAllUserHostAccess implements the policy.HostAccessProvider interface.
func (*Service) OnUserEvent ¶
type UserHostGrant ¶
UserHostGrant is a resolved (user, fqdn) access grant.
type UserHostSetting ¶
type UserHostSetting struct {
UserID ids.UserID `db:"user_id"`
BypassHostCheck bool `db:"bypass_host_check"`
}
UserHostSetting is the per-user bypass flag from user_host_settings.