Documentation
¶
Overview ¶
Package cache handles transaction with an underlying database to cache user and group information.
Index ¶
- func RemoveDb(cacheDir string) error
- func Z_ForTests_CreateDBFromYAML(t *testing.T, src, destDir string)
- func Z_ForTests_DBName() string
- func Z_ForTests_DumpNormalizedYAML(c *Cache) (string, error)
- func Z_ForTests_FromYAML(r io.Reader, destDir string) error
- type Cache
- func (c *Cache) AllGroups() (all []GroupDB, err error)
- func (c *Cache) AllUsers() (all []UserDB, err error)
- func (c *Cache) BrokerForUser(username string) (brokerID string, err error)
- func (c *Cache) Close() error
- func (c *Cache) DeleteUser(uid uint32) error
- func (c *Cache) GroupByID(gid uint32) (GroupDB, error)
- func (c *Cache) GroupByName(name string) (GroupDB, error)
- func (c *Cache) GroupByUGID(ugid string) (GroupDB, error)
- func (c *Cache) UpdateBrokerForUser(username, brokerID string) error
- func (c *Cache) UpdateUserEntry(usr UserDB, authdGroups []GroupDB, localGroups []string) error
- func (c *Cache) UserByID(uid uint32) (UserDB, error)
- func (c *Cache) UserByName(name string) (UserDB, error)
- func (c *Cache) UserGroups(uid uint32) ([]GroupDB, error)
- func (c *Cache) UserLocalGroups(uid uint32) ([]string, error)
- type GroupDB
- type NoDataFoundError
- type UserDB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Z_ForTests_CreateDBFromYAML ¶ added in v0.4.1
Z_ForTests_CreateDBFromYAML creates the database inside destDir and loads the src file content into it.
nolint:revive,nolintlint // We want to use underscores in the function name here.
func Z_ForTests_DBName ¶ added in v0.4.1
func Z_ForTests_DBName() string
Z_ForTests_DBName returns the name of the database.
nolint:revive,nolintlint // We want to use underscores in the function name here.
func Z_ForTests_DumpNormalizedYAML ¶ added in v0.4.1
Z_ForTests_DumpNormalizedYAML gets the content of the database, normalizes it (so that it can be compared with a golden file) and returns it as a YAML string.
nolint:revive,nolintlint // We want to use underscores in the function name here.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is our database API.
func (*Cache) BrokerForUser ¶
BrokerForUser returns the broker ID assigned to the given username, empty if it's not assigned yet or an error if no user was found in cache.
func (*Cache) DeleteUser ¶
DeleteUser removes the user from the database.
func (*Cache) GroupByID ¶
GroupByID returns a group matching this gid or an error if the database is corrupted or no entry was found.
func (*Cache) GroupByName ¶
GroupByName returns a group matching a given name or an error if the database is corrupted or no entry was found.
func (*Cache) GroupByUGID ¶ added in v0.4.1
GroupByUGID returns a group matching this ugid or an error if the database is corrupted or no entry was found.
func (*Cache) UpdateBrokerForUser ¶
UpdateBrokerForUser updates the last broker the user successfully authenticated with.
func (*Cache) UpdateUserEntry ¶
UpdateUserEntry inserts or updates user and group buckets from the user information.
func (*Cache) UserByID ¶
UserByID returns a user matching this uid or an error if the database is corrupted or no entry was found.
func (*Cache) UserByName ¶
UserByName returns a user matching this name or an error if the database is corrupted or no entry was found.
func (*Cache) UserGroups ¶
UserGroups returns all groups for a given user or an error if the database is corrupted or no entry was found.
type NoDataFoundError ¶
type NoDataFoundError struct {
// contains filtered or unexported fields
}
NoDataFoundError is returned when we didn’t find a matching entry.
func (NoDataFoundError) Error ¶
func (err NoDataFoundError) Error() string
Error implements the error interface to return key/bucket name.
func (NoDataFoundError) Is ¶
func (NoDataFoundError) Is(target error) bool
Is makes this error insensitive to the key and bucket name.
type UserDB ¶
type UserDB struct {
Name string
UID uint32
GID uint32
Gecos string // Gecos is an optional field. It can be empty.
Dir string
Shell string
// Shadow entries
LastPwdChange int
MaxPwdAge int
PwdWarnPeriod int
PwdInactivity int
MinPwdAge int
ExpirationDate int
}
UserDB is the public type that is shared to external packages.