users

package
v0.0.0-...-8e942fd Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	Login        string          `yaml:"-"`
	PasswordHash string          `yaml:"password"`
	PasswordSalt string          `yaml:"salt"`
	YamledGroups []string        `yaml:"groups"` //for keep in user file
	Groups       map[string]bool `yaml:"-"`
	// contains filtered or unexported fields
}

User data

func AddUser

func AddUser(usersPath *fs.Fs, login *string, password []byte) *User

AddUser add new User. Function get path to "users" dir. Password will be hashed and erased

func LoadUser

func LoadUser(path *fs.Fs, login string) *User

LoadUser create User based on data at given path

func (*User) AddToGroup

func (u *User) AddToGroup(group string)

AddToGroup adds user to given group

func (*User) CheckGroup

func (u *User) CheckGroup(group *string) bool

CheckGroup checks if user is in given group

func (*User) SaveData

func (u *User) SaveData()

SaveData save user config to file

func (*User) VerifyPassword

func (u *User) VerifyPassword(password []byte) bool

VerifyPassword perform password verification based on stored hash and salt

Jump to

Keyboard shortcuts

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