impersonate

package
v2.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserKeyName              = xcontext.UserCtxKey
	ImpersonatingUserKeyName = "x_impersonating_user"
)

Variables

This section is empty.

Functions

func NewImpersonateUserMiddleware

func NewImpersonateUserMiddleware(
	users UserReader,
	impersonatedHeaderName string,
	permissionToImpersonate string,
	permissionToImpersonateAll string,
	logger *zap.Logger,
) echo.MiddlewareFunc

NewImpersonateUserMiddleware returns a middleware to impersonate a user

func NewImpersonationError

func NewImpersonationError(msg string, args ...any) error

Types

type ManagedUser

type ManagedUser interface {
	IsManagedBy(id ids.Id) bool
}

ManagedUser is a user that is managed by another user

type UserReader

type UserReader interface {
	FindById(ctx context.Context, id ids.Id) (xuser.User, error)
}

UserReader is a collaborator that is used to find users by their Id

Jump to

Keyboard shortcuts

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