vptable

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2018 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 VPEntry

type VPEntry struct {
	Password  string
	Directory string
	Forwards  string
	Personal  string
	HardQuota uint
	SoftQuota uint
	MsgSize   uint
	MsgCount  uint
	ChangedAt time.Time
}

VPEntry represents an entry in the VMailMgr password database

func (*VPEntry) UpdatePassword

func (v *VPEntry) UpdatePassword(newPass string) (bool, error)

UpdatePassword checks for password equality and updates the password when required. If the password is updated the change timestamp is also set to current date

type VPTable

type VPTable struct {
	// contains filtered or unexported fields
}

VPTable contains a complete password database for VMailMgr including the right order to ensure the database does not change if there are no content changes

func LoadFromFile

func LoadFromFile(srcFile string) (*VPTable, error)

LoadFromFile reads the CDB file and parses the entries to be editable

func New

func New() *VPTable

func (VPTable) Get

func (v VPTable) Get(key string) *VPEntry

Get retrieves a pointer to the VPEntry of the user given as key

func (*VPTable) Remove

func (v *VPTable) Remove(key string)

func (VPTable) SaveToFile

func (v VPTable) SaveToFile(destFile string) error

SaveToFile writes the database into the CDB file format

func (*VPTable) Upsert

func (v *VPTable) Upsert(key string, entry *VPEntry)

Upsert adds a new entry if it does not exist or updates the existing if it already does (not required when using Get as the pointer can be changed directly)

func (VPTable) Users

func (v VPTable) Users() []string

Users returns a list of all known users

Jump to

Keyboard shortcuts

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