cards

package
v0.8.10 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const CardCreated = schema.Created
View Source
const CardDeleted = schema.Deleted
View Source
const CardFrom = schema.CardFrom
View Source
const CardGroups = schema.CardGroups
View Source
const CardModified = schema.Modified
View Source
const CardName = schema.CardName
View Source
const CardNumber = schema.CardNumber
View Source
const CardPIN = schema.CardPIN
View Source
const CardStatus = schema.Status
View Source
const CardTo = schema.CardTo
View Source
const GroupName = schema.GroupName

Variables

This section is empty.

Functions

func CanAdd added in v0.8.3

func CanAdd[T TAuthable](a auth.OpAuth, u T) error

func CanDelete added in v0.8.3

func CanDelete[T TAuthable](a auth.OpAuth, u T) error

func CanUpdate added in v0.8.3

func CanUpdate[T TAuthable](a auth.OpAuth, u T, field string, value any) error

func CanView added in v0.8.3

func CanView[T TAuthable](a auth.OpAuth, u T, field string, value any) error

Types

type Card

type Card struct {
	catalog.CatalogCard
	// contains filtered or unexported fields
}

func (Card) AsAclCard

func (c Card) AsAclCard() (lib.Card, bool)

func (*Card) AsObjects

func (c *Card) AsObjects(a *auth.Authorizator) []schema.Object

func (Card) AsRuleEntity

func (c Card) AsRuleEntity() (string, interface{})

func (Card) CacheKey added in v0.8.10

func (c Card) CacheKey() string

func (Card) From

func (c Card) From() lib.Date

func (Card) Groups

func (c Card) Groups() []schema.OID

func (Card) IsDeleted

func (c Card) IsDeleted() bool

func (Card) IsValid

func (c Card) IsValid() bool

func (Card) PIN added in v0.8.4

func (c Card) PIN() uint32

func (*Card) Status

func (c *Card) Status() types.Status

func (Card) String

func (c Card) String() string

func (Card) To

func (c Card) To() lib.Date

type Cards

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

func NewCards

func NewCards() Cards

func (*Cards) AsObjects

func (cc *Cards) AsObjects(a *auth.Authorizator, start, count int) []schema.Object

func (*Cards) Clone

func (cc *Cards) Clone() Cards

NTS: 'added' is specifically not cloned - it has a lifetime for the duration of

the 'shadow' copy only

func (*Cards) Create

func (cc *Cards) Create(a *auth.Authorizator, oid schema.OID, value string, dbc db.DBC) ([]schema.Object, error)

func (*Cards) Delete

func (cc *Cards) Delete(a *auth.Authorizator, oid schema.OID, dbc db.DBC) ([]schema.Object, error)

func (*Cards) Found

func (cc *Cards) Found(found []uint32)

Some of this is a bit obscure, so: * * 1. FOUND cards are cards present on any one of the controllers that are not * in the cards list * 2. A FOUND card is marked 'unconfigured' until manually edited which adds it * to the known list * 3. A FOUND card that is deleted externally (e.g. by uhppote-cli) is automatically * removed * 4. A FOUND card that is deleted is marked as deleted but left unconfigured. It is * removed from the controllers but not from the internal cards list until the next * scan. * 5. The deleted flag is removed from a FOUND card that is deleted and subsequently * reinstated externally * 6. A card that is 'known' but deleted and then reinstated externally is marked 'found' * and marked not deleted * 7. This is insanely more complicated than it should be and there has to be a better * way :-(

func (*Cards) List

func (cc *Cards) List() []Card

func (*Cards) Load

func (cc *Cards) Load(blob json.RawMessage) error

func (Cards) Lookup

func (cc Cards) Lookup(card uint32) (*Card, bool)

func (*Cards) MarkIncorrect

func (cc *Cards) MarkIncorrect(list []uint32)

func (*Cards) Print

func (cc *Cards) Print()

func (*Cards) Save

func (cc *Cards) Save() (json.RawMessage, error)

func (*Cards) Sweep

func (cc *Cards) Sweep(retention time.Duration)

func (*Cards) Update

func (cc *Cards) Update(a *auth.Authorizator, oid schema.OID, value string, dbc db.DBC) ([]schema.Object, error)

func (Cards) Validate

func (cc Cards) Validate() error

type TAuthable added in v0.8.3

type TAuthable interface {
	Card | *Card

	AsRuleEntity() (string, any)
	CacheKey() string
}

Jump to

Keyboard shortcuts

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