usercontext

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckUserInAllowList

func CheckUserInAllowList(allowList []string) middleware.Middleware

Middleware that checks that the user is defined in the allow list

func WithCurrentRobotAccount

func WithCurrentRobotAccount(robotAccountUseCase *biz.RobotAccountUseCase, logger *log.Helper) middleware.Middleware

Middleware that injects the current user to the context

func WithCurrentUserAndOrgMiddleware

func WithCurrentUserAndOrgMiddleware(userUseCase biz.UserOrgFinder, logger *log.Helper) middleware.Middleware

Middleware that injects the current user to the context

Types

type Org

type Org struct {
	ID, Name  string
	CreatedAt *time.Time
}

func CurrentOrg

func CurrentOrg(ctx context.Context) *Org

RequestID tries to retrieve requestID from the given context. If it doesn't exist, an empty string is returned.

type RobotAccount

type RobotAccount struct {
	ID, WorkflowID, OrgID string
}

func CurrentRobotAccount

func CurrentRobotAccount(ctx context.Context) *RobotAccount

type User

type User struct {
	Email, ID string
	CreatedAt *time.Time
}

Utils to get and set information from context

func CurrentUser

func CurrentUser(ctx context.Context) *User

RequestID tries to retrieve requestID from the given context. If it doesn't exist, an empty string is returned.

Jump to

Keyboard shortcuts

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