Documentation ¶
Index ¶
- Constants
- type ErrUserAlreadyExists
- type Group
- type User
- type UserStore
- func (us *UserStore) Create(name, password string) (*User, error)
- func (us *UserStore) GetByID(id []byte) (*User, error)
- func (us *UserStore) GetByName(name string) (*User, error)
- func (us *UserStore) Group(name string) (*Group, error)
- func (us *UserStore) Groups() []string
- func (us *UserStore) HasGroup(name string) *Group
- func (us *UserStore) List() []string
- func (us *UserStore) Login(name, password string) (*User, error)
- func (us *UserStore) Update(u *User) error
Constants ¶
View Source
const ( UserIDLen = 10 ErrUserNotFound = lerr.Str("User not found") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrUserAlreadyExists ¶
type ErrUserAlreadyExists string
func (ErrUserAlreadyExists) Error ¶
func (u ErrUserAlreadyExists) Error() string
type User ¶
type User struct { ID []byte `json:"-"` Name string HashedPassword []byte Groups slice.Slice[string] }
func (*User) CheckPassword ¶
func (*User) OneRequired ¶
OneRequired requires that a user be in one of the listed groups. If no groups are listed, the result is true.
func (*User) SetPassword ¶
type UserStore ¶
type UserStore struct {
// contains filtered or unexported fields
}
func (*UserStore) Group ¶
Group will return a group with the provided name. If one does not already exist, it will be created.
Click to show internal directories.
Click to hide internal directories.