Documentation

Index

Constants

View Source
const (
	//DS is the location of the user datastore
	DS = "core" + string(os.PathSeparator) + "user.ds"
)

Variables

View Source
var ErrLogon = errors.New("Invalid user and / or password")

    ErrLogon is when a user fails a logon

    Functions

    func All

    func All() (map[string]*User, error)

      All returns all the users in a freehold instance

      func Delete

      func Delete(username string) error

        Delete deletes a user

        func New

        func New(username string, u *User) error

          New creates a new user

          Types

          type User

          type User struct {
          	Name        string `json:"name,omitempty"`
          	Password    string `json:"password,omitempty"`
          	EncPassword []byte `json:"encPassword,omitempty"`
          	HomeApp     string `json:"homeApp,omitempty"`
          	Admin       bool   `json:"admin,omitempty"`
          	// contains filtered or unexported fields
          }

            User is a user in a freehold instance

            func Get

            func Get(username string) (*User, error)

              Get retrieves a user

              func (*User) Login

              func (u *User) Login(password string) error

                Login is when a user attempts to log in

                func (*User) Update

                func (u *User) Update() error

                  Update updates the passed in user

                  func (*User) UpdatePassword

                  func (u *User) UpdatePassword(password string) error

                    UpdatePassword is called when a user changes their password

                    func (*User) Username

                    func (u *User) Username() string

                      Username is the user's username

                      Source Files