users

package
v0.4.0-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2022 License: Apache-2.0, BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DerivePasswordKey added in v1.0.3

func DerivePasswordKey(password string, passwordSaltHex ...string) (string, string, error)

DerivePasswordKey derives a password key by hashing the given password with a salt.

Types

type User added in v1.0.3

type User struct {
	Name         string
	PasswordHash []byte
	PasswordSalt []byte
	Permissions  map[string]struct{}
}

func NewUser added in v1.0.3

func NewUser(username, passwordHashHex, passwordSaltHex string, permissions map[string]struct{}) (*User, error)

func (*User) Clone added in v1.0.3

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

func (u *User) PermissionsSlice() []string

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) 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) 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL