users

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: GPL-3.0 Imports: 12 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 GroupEntry

type GroupEntry struct {
	Name  string
	GID   uint32
	Users []string
}

GroupEntry is the group information sent to the NSS service.

type GroupInfo

type GroupInfo struct {
	Name string
	GID  *uint32
	UGID string
}

GroupInfo is the group information returned by the broker.

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) (m *Manager, err error)

NewManager creates a new user manager.

func (*Manager) AllGroups

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

AllGroups returns all groups.

func (*Manager) AllShadows

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

AllShadows returns all shadow entries.

func (*Manager) AllUsers

func (m *Manager) AllUsers() ([]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) GenerateGID

func (m *Manager) GenerateGID(str string) uint32

GenerateGID deterministically generates an ID between from the given string, ignoring case, in the range [GIDMin, GIDMax]. The generated ID is *not* guaranteed to be unique.

func (*Manager) GenerateUID

func (m *Manager) GenerateUID(str string) uint32

GenerateUID deterministically generates an ID between from the given string, ignoring case, in the range [UIDMin, UIDMax]. The generated ID is *not* guaranteed to be unique.

func (*Manager) GroupByID

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

GroupByID returns the group information for the given group ID.

func (*Manager) GroupByName

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

GroupByName returns the group information for the given group name.

func (*Manager) ShadowByName

func (m *Manager) ShadowByName(username string) (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 UserInfo) (err error)

UpdateUser updates the user information in the cache.

func (*Manager) UserByID

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

UserByID returns the user information for the given user ID.

func (*Manager) UserByName

func (m *Manager) UserByName(username string) (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 ShadowEntry

type ShadowEntry struct {
	Name           string
	LastPwdChange  int
	MaxPwdAge      int
	PwdWarnPeriod  int
	PwdInactivity  int
	MinPwdAge      int
	ExpirationDate int
}

ShadowEntry is the shadow information sent to the NSS service.

type UserEntry

type UserEntry struct {
	Name  string
	UID   uint32
	GID   uint32
	Gecos string
	Dir   string
	Shell string
}

UserEntry is the user information sent to the NSS service.

type UserInfo

type UserInfo struct {
	Name  string
	UID   uint32
	Gecos string
	Dir   string
	Shell string

	Groups []GroupInfo
}

UserInfo is the user information returned by the broker.

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.
testutils
Package cachetestutils export cache test functionalities used by other packages.
Package cachetestutils export cache test functionalities used by other packages.
Package localgroups handles the synchronization of local groups the users.
Package localgroups handles the synchronization of local groups the users.
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 userstestutils export cache test functionalities used by other packages.
Package userstestutils export cache test functionalities used by other packages.

Jump to

Keyboard shortcuts

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