impersonate

package
v2.5.4 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 9 Imported by: ? 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

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