Documentation ¶
Index ¶
- Variables
- func DerivePasswordKey(password string, passwordSaltHex ...string) ([]byte, []byte, error)
- type User
- type UserManager
- func (m *UserManager) AddUser(user *User) error
- func (m *UserManager) ChangeUserPassword(name string, passwordHash, passwordSalt []byte) error
- func (m *UserManager) ChangeUserPermissions(name string, permissions map[string]struct{}) error
- func (m *UserManager) EnableStoreOnChange()
- func (m *UserManager) ModifyUser(user *User) error
- func (m *UserManager) RemoveUser(name string) error
- func (m *UserManager) SanitizePermissions(permissions map[string]struct{}) map[string]struct{}
- func (m *UserManager) User(name string) (*User, error)
- func (m *UserManager) Users() map[string]*User
Constants ¶
This section is empty.
Variables ¶
View Source
var AllowedPermissions = []string{"read", "write"}
Functions ¶
Types ¶
type User ¶ added in v1.0.3
type User struct { Name string PasswordHash []byte PasswordSalt []byte Permissions map[string]struct{} }
func (*User) Clone ¶ added in v1.0.3
func (u *User) Clone() onchangemap.Item[string, util.ComparableString]
Clone returns a copy of a user.
func (*User) ID ¶ added in v1.0.3
func (u *User) ID() util.ComparableString
func (*User) PermissionsSlice ¶ added in v1.0.3
PermissionsSlice returns the permissions of the user as a slice.
type UserManager ¶ added in v1.0.3
type UserManager struct {
// contains filtered or unexported fields
}
UserManager handles the list of users that are stored in the user config. It calls a function if the list changed.
func NewUserManager ¶ added in v1.0.3
func NewUserManager(storeCallback func([]*User) error) *UserManager
NewUserManager creates a new user manager.
func (*UserManager) AddUser ¶ added in v1.0.3
func (m *UserManager) AddUser(user *User) error
AddUser adds a user to the user manager.
func (*UserManager) ChangeUserPassword ¶ added in v1.0.3
func (m *UserManager) ChangeUserPassword(name string, passwordHash, passwordSalt []byte) error
ChangeUserPassword changes the password of a user.
func (*UserManager) ChangeUserPermissions ¶ added in v1.0.3
func (m *UserManager) ChangeUserPermissions(name string, permissions map[string]struct{}) error
ChangeUserPermissions changes the permissions of a user.
func (*UserManager) EnableStoreOnChange ¶ added in v1.0.3
func (m *UserManager) EnableStoreOnChange()
func (*UserManager) ModifyUser ¶ added in v1.0.3
func (m *UserManager) ModifyUser(user *User) error
ModifyUser modifies a user in the user manager.
func (*UserManager) RemoveUser ¶ added in v1.0.3
func (m *UserManager) RemoveUser(name string) error
RemoveUser removes a user from the user manager.
func (*UserManager) SanitizePermissions ¶ added in v1.0.3
func (m *UserManager) SanitizePermissions(permissions map[string]struct{}) map[string]struct{}
func (*UserManager) User ¶ added in v1.0.3
func (m *UserManager) User(name string) (*User, error)
User returns a copy of a user.
func (*UserManager) Users ¶ added in v1.0.3
func (m *UserManager) Users() map[string]*User
Users returns a copy of all known users.
Click to show internal directories.
Click to hide internal directories.