userloginstate

package
v0.0.0-...-5c79d48 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessListsAndLockGetter

type AccessListsAndLockGetter interface {
	services.AccessListsGetter
	services.LockGetter
}

AccessListsAndLockGetter is an interface for retrieving access lists and locks.

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator will generate a user login state from a user.

func NewGenerator

func NewGenerator(config GeneratorConfig) (*Generator, error)

NewGenerator creates a new user login state generator.

func (*Generator) Generate

Generate will generate the user login state for the given user.

func (*Generator) LoginHook

func (g *Generator) LoginHook(ulsService services.UserLoginStates) func(context.Context, types.User) error

LoginHook creates a login hook from the Generator and the user login state service.

func (*Generator) Refresh

Refresh will take the user and update the user login state in the backend.

type GeneratorConfig

type GeneratorConfig struct {
	// Log is a logger to use for the generator.
	Log *logrus.Entry

	// AccessLists is a service for retrieving access lists and locks from the backend.
	AccessLists AccessListsAndLockGetter

	// Access is a service that will be used for retrieving roles from the backend.
	Access services.Access

	// UsageEventsClient is the client for sending usage events metrics.
	UsageEvents UsageEventsClient

	// Clock is the clock to use for the generator.
	Clock clockwork.Clock
}

GeneratorConfig is the configuration for the user login state generator.

func (*GeneratorConfig) CheckAndSetDefaults

func (g *GeneratorConfig) CheckAndSetDefaults() error

type Service

type Service struct {
	userloginstatev1.UnimplementedUserLoginStateServiceServer
	// contains filtered or unexported fields
}

func NewService

func NewService(cfg ServiceConfig) (*Service, error)

NewService creates a new User Login State gRPC service.

func (*Service) DeleteAllUserLoginStates

func (s *Service) DeleteAllUserLoginStates(ctx context.Context, _ *userloginstatev1.DeleteAllUserLoginStatesRequest) (*emptypb.Empty, error)

DeleteAllUserLoginStates removes all user login states.

func (*Service) DeleteUserLoginState

func (s *Service) DeleteUserLoginState(ctx context.Context, req *userloginstatev1.DeleteUserLoginStateRequest) (*emptypb.Empty, error)

DeleteUserLoginState removes the specified user login state resource.

func (*Service) GetUserLoginState

GetUserLoginState returns the specified user login state resource.

func (*Service) GetUserLoginStates

GetUserLoginStates returns a list of all user login states.

func (*Service) UpsertUserLoginState

UpsertUserLoginState creates or updates a user login state resource.

type ServiceConfig

type ServiceConfig struct {
	// Logger is the logger to use.
	Logger logrus.FieldLogger

	// Authorizer is the authorizer to use.
	Authorizer authz.Authorizer

	// UserLoginStates is the user login state service to use.
	UserLoginStates services.UserLoginStates

	// Clock is the clock.
	Clock clockwork.Clock
}

ServiceConfig is the service config for the Access Lists gRPC service.

type UsageEventsClient

type UsageEventsClient interface {
	// SubmitUsageEvent submits an external usage event.
	SubmitUsageEvent(ctx context.Context, req *proto.SubmitUsageEventRequest) error
}

UsageEventsClient is an interface that allows for submitting usage events to Posthog.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL