Help us shape the future of Go! Take the 2026 Go Developer Survey

usermapper

package
v2.52.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mapper

type Mapper interface {
	RunInBaseScope(f func() error) error
	ScopeBase() (func() error, error)
	ScopeUser(ctx context.Context) (func() error, error)
	ScopeUserByIds(uid, gid int) (func() error, error)
}

Mapper is the interface that wraps the basic mapping methods

type NullMapper

type NullMapper struct{}

NullMapper is a user mapper that does nothing

func (*NullMapper) RunInBaseScope

func (nm *NullMapper) RunInBaseScope(f func() error) error

RunInBaseScope runs the given function in the scope of the base user

func (*NullMapper) ScopeBase

func (nm *NullMapper) ScopeBase() (func() error, error)

ScopeBase returns to the base uid and gid returning a function that can be used to restore the previous scope

func (*NullMapper) ScopeUser

func (nm *NullMapper) ScopeUser(ctx context.Context) (func() error, error)

ScopeUser returns to the base uid and gid returning a function that can be used to restore the previous scope

func (*NullMapper) ScopeUserByIds

func (nm *NullMapper) ScopeUserByIds(uid, gid int) (func() error, error)

type UnixMapper

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

UnixMapper is a user mapper that maps users to unix uids and gids

func NewUnixMapper

func NewUnixMapper() *UnixMapper

New returns a new user mapper

func (*UnixMapper) RunInBaseScope

func (um *UnixMapper) RunInBaseScope(f func() error) error

RunInUserScope runs the given function in the scope of the base user

func (*UnixMapper) ScopeBase

func (um *UnixMapper) ScopeBase() (func() error, error)

ScopeBase returns to the base uid and gid returning a function that can be used to restore the previous scope

func (*UnixMapper) ScopeUser

func (um *UnixMapper) ScopeUser(ctx context.Context) (func() error, error)

ScopeUser returns to the base uid and gid returning a function that can be used to restore the previous scope

func (*UnixMapper) ScopeUserByIds

func (um *UnixMapper) ScopeUserByIds(uid, gid int) (func() error, error)

ScopeUserByIds scopes the current user to the given uid and gid returning a function that can be used to restore the previous scope

type UnscopeFunc

type UnscopeFunc func() error

UnscopeFunc is a function that unscopes the current user

Jump to

Keyboard shortcuts

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