Documentation
¶
Overview ¶
Code generated by "idlimitsgenerator"; DO NOT EDIT.
Package users support all common action on the system for user handling.
Index ¶
- Variables
- type Config
- type GroupIsPrimaryError
- type IDGenerator
- type IDGeneratorIface
- type IDGeneratorMock
- type IDOwner
- type Manager
- func (m *Manager) AllGroups() ([]types.GroupEntry, error)
- func (m *Manager) AllShadows() ([]types.ShadowEntry, error)
- func (m *Manager) AllUsers() ([]types.UserEntry, error)
- func (m *Manager) BrokerAndProviderIDForUser(username string) (brokerID, providerID string, err error)
- func (m *Manager) BrokerForUser(username string) (string, error)
- func (m *Manager) DeleteGroup(groupname string) error
- func (m *Manager) DeleteUser(username string, removeHome bool) (err error)
- func (m *Manager) GroupByID(gid uint32) (types.GroupEntry, error)
- func (m *Manager) GroupByName(groupname string) (types.GroupEntry, error)
- func (m *Manager) IsUserLocked(username string) (bool, error)
- func (m *Manager) IsUserLockedByProviderID(brokerID, providerID string) (bool, error)
- func (m *Manager) LockUser(username string) error
- func (m *Manager) RegisterUserPreAuth(name string) (uid uint32, err error)
- func (m *Manager) SetGroupID(name string, gid uint32) (resp *SetGroupIDResp, err error)
- func (m *Manager) SetHomeDir(name, home string) (resp *SetHomeDirResp, err error)
- func (m *Manager) SetShell(username, shell string) (warnings []string, err error)
- func (m *Manager) SetUserID(name string, uid uint32) (resp *SetUserIDResp, err error)
- func (m *Manager) ShadowByName(username string) (types.ShadowEntry, error)
- func (m *Manager) Stop() error
- func (m *Manager) UnlockUser(username string) error
- func (m *Manager) UpdateBrokerForUser(username, brokerID string) error
- func (m *Manager) UpdateUser(u types.UserInfo) (err error)
- func (m *Manager) UsedGIDs() ([]uint32, error)
- func (m *Manager) UsedUIDs() ([]uint32, error)
- func (m *Manager) UserByID(uid uint32) (types.UserEntry, error)
- func (m *Manager) UserByName(username string) (types.UserEntry, error)
- type NoDataFoundError
- type Option
- type SetGroupIDResp
- type SetHomeDirResp
- type SetUserIDResp
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig = Config{
UIDMin: 10000,
UIDMax: 60000,
GIDMin: 10000,
GIDMax: 60000,
}
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" yaml:"uid_min"`
UIDMax uint32 `mapstructure:"uid_max" yaml:"uid_max"`
GIDMin uint32 `mapstructure:"gid_min" yaml:"gid_min"`
GIDMax uint32 `mapstructure:"gid_max" yaml:"gid_max"`
}
Config is the configuration for the user manager.
type GroupIsPrimaryError ¶ added in v0.7.0
GroupIsPrimaryError is returned when trying to delete a group that is still the primary group of one or more users.
func (GroupIsPrimaryError) Error ¶ added in v0.7.0
func (e GroupIsPrimaryError) Error() string
Error implements the error interface for GroupIsPrimaryError.
type IDGenerator ¶
type IDGenerator struct {
UIDMin uint32
UIDMax uint32
GIDMin uint32
GIDMax uint32
// contains filtered or unexported fields
}
IDGenerator is an ID generator that generates UIDs and GIDs in a specific range.
func (*IDGenerator) GenerateGID ¶
func (g *IDGenerator) GenerateGID(lockedEntries *localentries.UserDBLocked, owner IDOwner) (uint32, func(), error)
GenerateGID generates a random GID in the configured range.
func (*IDGenerator) GenerateUID ¶
func (g *IDGenerator) GenerateUID(lockedEntries *localentries.UserDBLocked, owner IDOwner) (uint32, func(), error)
GenerateUID generates a random UID in the configured range.
type IDGeneratorIface ¶
type IDGeneratorIface interface {
GenerateUID(lockedEntries *localentries.UserDBLocked, owner IDOwner) (uid uint32, cleanup func(), err error)
GenerateGID(lockedEntries *localentries.UserDBLocked, owner IDOwner) (gid uint32, cleanup func(), err error)
}
IDGeneratorIface is the interface that must be implemented by the ID generator.
type IDGeneratorMock ¶
IDGeneratorMock is a mock implementation of the IDGenerator interface.
func (*IDGeneratorMock) GenerateGID ¶
func (g *IDGeneratorMock) GenerateGID(_ *localentries.UserDBLocked, _ IDOwner) (uint32, func(), error)
GenerateGID generates a GID.
func (*IDGeneratorMock) GenerateUID ¶
func (g *IDGeneratorMock) GenerateUID(_ *localentries.UserDBLocked, _ IDOwner) (uint32, func(), error)
GenerateUID generates a UID.
type IDOwner ¶
IDOwner is the interface that must be implemented by the IDs owner to provide the currently used UIDs and GIDs.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is the manager for any user related operation.
func NewManager ¶
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) BrokerAndProviderIDForUser ¶ added in v0.7.0
func (m *Manager) BrokerAndProviderIDForUser(username string) (brokerID, providerID string, err error)
BrokerAndProviderIDForUser returns the broker ID and the stable provider identifier recorded for the user in a single database lookup. Both values are empty if not recorded (pre-migration user, v2 broker, or local user).
func (*Manager) BrokerForUser ¶
BrokerForUser returns the broker ID for the given user.
func (*Manager) DeleteGroup ¶ added in v0.7.0
DeleteGroup removes the group with the given name from the database.
func (*Manager) DeleteUser ¶ added in v0.7.0
DeleteUser removes the user with the given name from the database. If removeHome is true, the user's home directory is also removed.
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) IsUserLocked ¶
IsUserLocked returns true if the user with the given user name is locked, false otherwise.
func (*Manager) IsUserLockedByProviderID ¶ added in v0.7.0
IsUserLockedByProviderID returns true if the user identified by the given broker-scoped provider ID is locked. It resolves the user by their stable identity rather than their name, so a lock set before an IdP-side username change is still honored. Returns a NoDataFoundError if no user matches.
func (*Manager) RegisterUserPreAuth ¶
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) SetGroupID ¶
func (m *Manager) SetGroupID(name string, gid uint32) (resp *SetGroupIDResp, err error)
SetGroupID updates the GID of the group with the given name to the specified GID.
func (*Manager) SetHomeDir ¶ added in v0.7.0
func (m *Manager) SetHomeDir(name, home string) (resp *SetHomeDirResp, err error)
SetHomeDir updates the home directory of the user with the given name to the specified path. If the user's current home directory exists, its contents are moved to the new location; the move is performed with rename(2), so the new path must reside on the same filesystem as the current one.
func (*Manager) SetUserID ¶
func (m *Manager) SetUserID(name string, uid uint32) (resp *SetUserIDResp, err error)
SetUserID updates the UID of the user with the given name to the specified UID.
func (*Manager) ShadowByName ¶
func (m *Manager) ShadowByName(username string) (types.ShadowEntry, error)
ShadowByName returns the shadow information for the given user name.
func (*Manager) UnlockUser ¶
UnlockUser sets the "locked" field to false for the given user.
func (*Manager) UpdateBrokerForUser ¶
UpdateBrokerForUser updates the broker ID for the given user.
func (*Manager) UpdateUser ¶
UpdateUser updates the user information in the db.
func (*Manager) UsedGIDs ¶
UsedGIDs returns all group IDs, including the GIDs of temporary pre-auth users.
func (*Manager) UsedUIDs ¶
UsedUIDs returns all user IDs, including the UIDs of temporary pre-auth users.
type NoDataFoundError ¶
type NoDataFoundError = db.NoDataFoundError
NoDataFoundError is the error returned when no entry is found in the db.
type Option ¶
type Option func(*options)
Option is a function that allows changing some of the default behaviors of the manager.
func WithIDGenerator ¶
func WithIDGenerator(g IDGeneratorIface) Option
WithIDGenerator makes the manager use a specific ID generator. This option is only useful in tests.
type SetGroupIDResp ¶
SetGroupIDResp is the response type of SetGroupID.
type SetHomeDirResp ¶ added in v0.7.0
SetHomeDirResp is the response type of SetHomeDir.
type SetUserIDResp ¶
SetUserIDResp is the response type of SetUserID.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package db handles transaction with an underlying database to store user and group information.
|
Package db handles transaction with an underlying database to store user and group information. |
|
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 userslocking implements locking of the local user and group files (/etc/passwd, /etc/groups, /etc/shadow, /etc/gshadow) via the libc lckpwdf() function.
|
Package userslocking implements locking of the local user and group files (/etc/passwd, /etc/groups, /etc/shadow, /etc/gshadow) via the libc lckpwdf() function. |
|
Package proc contains utilities for checking processes via /proc.
|
Package proc contains utilities for checking processes via /proc. |
|
Package tempentries provides a temporary pre-authentication records.
|
Package tempentries provides a temporary pre-authentication records. |
|
Package userstestutils export db test functionalities used by other packages.
|
Package userstestutils export db test functionalities used by other packages. |
|
Package types provides types for the users package.
|
Package types provides types for the users package. |