users

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package users support all common action on the system for user handling.

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	UIDMin: 1000000000,
	UIDMax: 1999999999,
	GIDMin: 1000000000,
	GIDMax: 1999999999,
}

DefaultConfig is the default configuration for the user manager.

Functions

This section is empty.

Types

type Config

type Config struct {
	UIDMin uint32 `mapstructure:"uid_min"`
	UIDMax uint32 `mapstructure:"uid_max"`
	GIDMin uint32 `mapstructure:"gid_min"`
	GIDMax uint32 `mapstructure:"gid_max"`
}

Config is the configuration for the user manager.

type Manager

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

Manager is the manager for any user related operation.

func NewManager

func NewManager(config Config, cacheDir string, args ...Option) (m *Manager, err error)

NewManager creates a new user manager.

func (*Manager) AllGroups

func (m *Manager) AllGroups() ([]types.GroupEntry, error)

AllGroups returns all groups.

func (*Manager) AllShadows

func (m *Manager) AllShadows() ([]types.ShadowEntry, error)

AllShadows returns all shadow entries.

func (*Manager) AllUsers

func (m *Manager) AllUsers() ([]types.UserEntry, error)

AllUsers returns all users.

func (*Manager) BrokerForUser

func (m *Manager) BrokerForUser(username string) (string, error)

BrokerForUser returns the broker ID for the given user.

func (*Manager) GroupByID

func (m *Manager) GroupByID(gid uint32) (types.GroupEntry, error)

GroupByID returns the group information for the given group ID.

func (*Manager) GroupByName

func (m *Manager) GroupByName(groupname string) (types.GroupEntry, error)

GroupByName returns the group information for the given group name.

func (*Manager) RegisterUserPreAuth added in v0.4.1

func (m *Manager) RegisterUserPreAuth(name string) (uint32, error)

RegisterUserPreAuth registers a temporary user with a unique UID in our NSS handler (in memory, not in the database).

The temporary user record is removed when UpdateUser is called with the same username.

func (*Manager) ShadowByName

func (m *Manager) ShadowByName(username string) (types.ShadowEntry, error)

ShadowByName returns the shadow information for the given user name.

func (*Manager) Stop

func (m *Manager) Stop() error

Stop closes the underlying cache.

func (*Manager) UpdateBrokerForUser

func (m *Manager) UpdateBrokerForUser(username, brokerID string) error

UpdateBrokerForUser updates the broker ID for the given user.

func (*Manager) UpdateUser

func (m *Manager) UpdateUser(u types.UserInfo) (err error)

UpdateUser updates the user information in the cache.

func (*Manager) UserByID

func (m *Manager) UserByID(uid uint32) (types.UserEntry, error)

UserByID returns the user information for the given user ID.

func (*Manager) UserByName

func (m *Manager) UserByName(username string) (types.UserEntry, error)

UserByName returns the user information for the given user name.

type NoDataFoundError

type NoDataFoundError = cache.NoDataFoundError

NoDataFoundError is the error returned when no entry is found in the cache.

type Option added in v0.4.1

type Option func(*options)

Option is a function that allows changing some of the default behaviors of the manager.

func WithIDGenerator added in v0.4.1

func WithIDGenerator(g tempentries.IDGenerator) Option

WithIDGenerator makes the manager use a specific ID generator. This option is only useful in tests.

Directories

Path Synopsis
Package cache handles transaction with an underlying database to cache user and group information.
Package cache handles transaction with an underlying database to cache user and group information.
Package idgenerator provides an ID generator that generates UIDs and GIDs in a specific range.
Package idgenerator provides an ID generator that generates UIDs and GIDs in a specific range.
Package localentries provides functions to access the local user and group database.
Package localentries provides functions to access the local user and group database.
testutils
Package localgrouptestutils export users test functionalities used by other packages to change cmdline and group file.
Package localgrouptestutils export users test functionalities used by other packages to change cmdline and group file.
Package tempentries provides a temporary user and group records.
Package tempentries provides a temporary user and group records.
Package userstestutils export cache test functionalities used by other packages.
Package userstestutils export cache test functionalities used by other packages.
Package types provides types for the users package.
Package types provides types for the users package.

Jump to

Keyboard shortcuts

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