acl

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 14 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(src, dst ACL) (map[uint32]Diff, error)

func CompareWithPIN added in v0.8.4

func CompareWithPIN(src, dst ACL) (map[uint32]Diff, error)

func GetCard

func GetCard(u uhppote.IUHPPOTE, devices []uhppote.Device, cardID uint32) (map[string]Permission, error)

func Grant

func Grant(u uhppote.IUHPPOTE, devices []uhppote.Device, cardID uint32, from, to types.Date, profile int, doors []string) error

func MakeFlatFile

func MakeFlatFile(acl ACL, devices []uhppote.Device, f io.Writer) error

func MakeFlatFileWithPIN added in v0.8.4

func MakeFlatFileWithPIN(acl ACL, devices []uhppote.Device, f io.Writer) error

func MakeTSV

func MakeTSV(acl ACL, devices []uhppote.Device, f io.Writer) error

func MakeTSVWithPIN added in v0.8.4

func MakeTSVWithPIN(acl ACL, devices []uhppote.Device, f io.Writer) error

func PutACL

func PutACL(u uhppote.IUHPPOTE, acl ACL, dryrun bool, formats ...types.CardFormat) (map[uint32]Report, []error)

func PutACLWithPIN added in v0.8.4

func PutACLWithPIN(u uhppote.IUHPPOTE, acl ACL, dryrun bool, formats ...types.CardFormat) (map[uint32]Report, []error)

func Revoke

func Revoke(u uhppote.IUHPPOTE, devices []uhppote.Device, cardID uint32, doors []string) error

Types

type ACL

type ACL map[uint32]map[uint32]types.Card

func GetACL

func GetACL(u uhppote.IUHPPOTE, devices []uhppote.Device) (ACL, []error)

func ParseTSV

func ParseTSV(f io.Reader, devices []uhppote.Device, strict bool) (ACL, []error, error)

func ParseTable

func ParseTable(table *Table, devices []uhppote.Device, strict bool) (*ACL, []error, error)

func (*ACL) Print

func (acl *ACL) Print(w io.Writer)

type ConsolidatedDiff

type ConsolidatedDiff struct {
	Unchanged []uint32 `json:"unchanged"`
	Updated   []uint32 `json:"updated"`
	Added     []uint32 `json:"added"`
	Deleted   []uint32 `json:"deleted"`
}

type ConsolidatedReport

type ConsolidatedReport struct {
	Unchanged []uint32 `json:"unchanged"`
	Updated   []uint32 `json:"updated"`
	Added     []uint32 `json:"added"`
	Deleted   []uint32 `json:"deleted"`
	Failed    []uint32 `json:"failed"`
	Errored   []uint32 `json:"errored"`
}

func Consolidate

func Consolidate(report map[uint32]Report) ConsolidatedReport

type Diff

type Diff struct {
	Unchanged []types.Card
	Updated   []types.Card
	Added     []types.Card
	Deleted   []types.Card
}

func (*Diff) HasChanges

func (d *Diff) HasChanges() bool

type DuplicateCardError

type DuplicateCardError struct {
	CardNumber uint32
}

func (*DuplicateCardError) Error

func (e *DuplicateCardError) Error() string

type Permission

type Permission struct {
	From    types.Date
	To      types.Date
	Profile int
}

type Report

type Report struct {
	Unchanged []uint32
	Updated   []uint32
	Added     []uint32
	Deleted   []uint32
	Failed    []uint32
	Errored   []uint32
	Errors    []error
}

type ReportSummary

type ReportSummary []struct {
	DeviceID  uint32 `json:"device-id"`
	Unchanged int    `json:"unchanged"`
	Updated   int    `json:"updated"`
	Added     int    `json:"added"`
	Deleted   int    `json:"deleted"`
	Failed    int    `json:"failed"`
	Errored   int    `json:"errored"`
}

func Summarize

func Summarize(report map[uint32]Report) ReportSummary

type SystemDiff

type SystemDiff map[uint32]Diff

func (*SystemDiff) Consolidate

func (diff *SystemDiff) Consolidate() *ConsolidatedDiff

func (*SystemDiff) HasChanges

func (diff *SystemDiff) HasChanges() bool

type Table

type Table struct {
	Header  []string
	Records [][]string
}

func MakeTable

func MakeTable(acl ACL, devices []uhppote.Device) (*Table, error)

func MakeTableWithPIN added in v0.8.4

func MakeTableWithPIN(acl ACL, devices []uhppote.Device) (*Table, error)

func (*Table) MarshalText

func (table *Table) MarshalText() []byte

func (*Table) MarshalTextIndent

func (table *Table) MarshalTextIndent(indent, gap string) []byte

func (*Table) ToTSV

func (table *Table) ToTSV(f io.Writer) error

Jump to

Keyboard shortcuts

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