persons

package
v2.1.6 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type List

type List struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewList

func NewList() List

func (*List) Add

func (l *List) Add(p PersonWithPasswords) error

Add adds a person to the list.

func (*List) All

func (l *List) All() PersonMap

All get all persons.

func (*List) Delete

func (l *List) Delete(id string) error

Get returns a person.

func (*List) Get

func (l *List) Get(id string) *Person

Get returns a person.

func (*List) GetByUsernameWithPassowrd

func (l *List) GetByUsernameWithPassowrd(username string) *PersonWithPassword

GetByEmail returns a person.

func (*List) Load

func (l *List) Load() error

func (*List) Save

func (l *List) Save() error

type Person

type Person struct {
	UUID       string `json:"uuid"`
	Name       string `json:"name"`
	Username   string `json:"username"`
	Email      string `json:"email"`
	AllowLogin bool   `json:"allow_login"`
	IsAdmin    bool   `json:"is_admin"`

	LastSeen time.Time `json:"last_seen"`

	State devices.State `json:"state"`
}

func (Person) Equal

func (a Person) Equal(b PersonWithPasswords) bool

Equal checks if 2 persons are equal.

type PersonMap

type PersonMap map[string]*Person

type PersonMapWithPassword

type PersonMapWithPassword map[string]*PersonWithPassword

type PersonWithPassword

type PersonWithPassword struct {
	Person
	Password string `json:"password"`
}

func (*PersonWithPassword) CheckPassword

func (p *PersonWithPassword) CheckPassword(password string) error

type PersonWithPasswords

type PersonWithPasswords struct {
	PersonWithPassword
	NewPassword    string `json:"new_password,omitempty"`
	RepeatPassword string `json:"repeat_password,omitempty"`
}

func (*PersonWithPasswords) UpdatePassword

func (a *PersonWithPasswords) UpdatePassword() error

Jump to

Keyboard shortcuts

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