Documentation ¶
Overview ¶
Package user provides management of user accounts.
Index ¶
- Constants
- Variables
- func DeleteUserProfile(ctx context.Context, w repo.RepositoryWriter, username string) error
- func LoadProfileMap(ctx context.Context, rep repo.Repository, old map[string]*Profile) (map[string]*Profile, error)
- func SetUserProfile(ctx context.Context, w repo.RepositoryWriter, p *Profile) error
- func ValidateUsername(name string) error
- type Profile
Constants ¶
const ManifestType = "user"
ManifestType is the type of the manifest used to represent user accounts.
const UsernameAtHostnameLabel = "username"
UsernameAtHostnameLabel is the manifest label identifying users by username@hostname.
Variables ¶
var ErrUserNotFound = errors.New("user not found")
ErrUserNotFound is returned to indicate that a user was not found in the system.
Functions ¶
func DeleteUserProfile ¶
DeleteUserProfile removes user profile with a given username.
func LoadProfileMap ¶
func LoadProfileMap(ctx context.Context, rep repo.Repository, old map[string]*Profile) (map[string]*Profile, error)
LoadProfileMap returns the map of all users profiles in the repository by username, using old map as a cache.
func SetUserProfile ¶
SetUserProfile creates or updates user profile.
func ValidateUsername ¶
ValidateUsername returns an error if the given username is invalid.
Types ¶
type Profile ¶
type Profile struct { ManifestID manifest.ID `json:"-"` Username string `json:"username"` PasswordHashVersion int `json:"passwordHashVersion"` // indicates how password is hashed PasswordHash []byte `json:"passwordHash"` }
Profile describes information about a single user.
func GetUserProfile ¶
GetUserProfile returns the user profile with a given username.
func ListUserProfiles ¶
ListUserProfiles gets the list of all user profiles in the system.
func (*Profile) IsValidPassword ¶
IsValidPassword determines whether the password is valid for a given user.
func (*Profile) SetPassword ¶
SetPassword changes the password for a user profile.