net2

package
v0.0.0-...-5901aa7 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DoorStatus_NoFlag            = 0
	DoorStatus_IntruderAlarm     = 1
	DoorStatus_PSUIsOK           = 2
	DoorStatus_TamperStatusGood  = 3
	DoorStatus_DoorContactClosed = 4
	DoorStatus_AlarmTripped      = 10
	DoorStatus_DoorOpen          = 20
)
View Source
const (
	JsonContentType = "application/json"
)

Variables

This section is empty.

Functions

func GetTomorrow

func GetTomorrow() time.Time

func GetYesterday

func GetYesterday() time.Time

Types

type AccessLevel

type AccessLevel struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type Area

type Area struct {
	ID   int    `json:"areaID"`
	Name string `json:"name"`
}

type CustomFieldDefinition

type CustomFieldDefinition struct {
	ID        int    `json:"id"`
	Name      string `json:"name"`
	Type      int    `json:"type"`
	MaxLength int    `json:"maxLength"`
}

type Department

type Department struct {
	ID   int    `json:"Id"`
	Name string `json:"Name"`
}

type Door

type Door struct {
	ID          uint64 `json:"id"`
	Name        string `json:"name"`
	StatusFlag  int
	AlarmStatus int
	AlarmZone   string
}

type DoorSequenceItem

type DoorSequenceItem struct {
	Door uint64        `json:"door"`
	Time time.Duration `json:"time"`
}

type Event

type Event struct {
	Date     time.Time `json:"EventDate"`
	Location string    `json:"where"`
	Token    int64     `json:"tokenNumber"`
}

type Permission

type Permission struct {
	AccessLevels          []int         `json:"accessLevels"`
	IndividualPermissions []AccessLevel `json:"individualPermissions"`
}

type Site

type Site struct {
	LocalIDField  string                         `json:"-"`
	AccessLevels  map[int]*AccessLevel           `json:"-"`
	Departments   map[int]*Department            `json:"-"`
	Users         map[int]*User                  `json:"-"`
	Fields        map[int]*CustomFieldDefinition `json:"-"`
	QuitChan      chan bool                      `json:"-"`
	BaseURL       string                         `json:"-"`
	Doors         map[uint64]*Door               `json:"-"`
	UnknownTokens []Event                        `json:"-"`
	SiteID        int                            `json:"ID"`
	Name          string                         `json:"Name"`
	LastPolled    time.Time                      `json:"lastPolled"`
	// contains filtered or unexported fields
}

func GetSites

func GetSites(conf *config.Config, logger *zerolog.Logger) []*Site

func (*Site) ActivateUser

func (s *Site) ActivateUser(userID int) error

func (*Site) AddUserAccessLevel

func (s *Site) AddUserAccessLevel(userID int, accesslevel int) error

func (*Site) ChangeUserDepartment

func (s *Site) ChangeUserDepartment(userID, departmentID int) error

func (*Site) CloseDoor

func (s *Site) CloseDoor(doorID uint64) error

func (*Site) DeactivateUser

func (s *Site) DeactivateUser(userID int) error

func (*Site) GetAccessLevels

func (s *Site) GetAccessLevels() map[int]*AccessLevel

func (*Site) GetActiveCleaners

func (s *Site) GetActiveCleaners() map[int]*User

func (*Site) GetActiveCleanersToday

func (s *Site) GetActiveCleanersToday() map[int]*User

func (*Site) GetActiveContractors

func (s *Site) GetActiveContractors() map[int]*User

func (*Site) GetActiveContractorsToday

func (s *Site) GetActiveContractorsToday() map[int]*User

func (*Site) GetActiveCustomers

func (s *Site) GetActiveCustomers() map[int]*User

func (*Site) GetActiveCustomersToday

func (s *Site) GetActiveCustomersToday() map[int]*User

func (*Site) GetActiveNonStaff

func (s *Site) GetActiveNonStaff() map[int]*User

func (*Site) GetActiveStaff

func (s *Site) GetActiveStaff() map[int]*User

func (*Site) GetActiveStaffToday

func (s *Site) GetActiveStaffToday() map[int]*User

func (*Site) GetActiveUsers

func (s *Site) GetActiveUsers() map[int]*User

func (*Site) GetActiveUsersInDepartment

func (s *Site) GetActiveUsersInDepartment(match func(test Department) bool) map[int]*User

func (*Site) GetActiveUsersToday

func (s *Site) GetActiveUsersToday() map[int]*User

func (*Site) GetActiveVisitors

func (s *Site) GetActiveVisitors() map[int]*User

func (*Site) GetActiveVisitorsToday

func (s *Site) GetActiveVisitorsToday() map[int]*User

func (*Site) GetBlankPicture

func (s *Site) GetBlankPicture() ([]byte, error)

func (*Site) GetCancelledUsers

func (s *Site) GetCancelledUsers() interface{}

func (*Site) GetCleaners

func (s *Site) GetCleaners() map[int]*User

func (*Site) GetContractors

func (s *Site) GetContractors() map[int]*User

func (*Site) GetCustomers

func (s *Site) GetCustomers() map[int]*User

func (*Site) GetDepartments

func (s *Site) GetDepartments() map[int]*Department

func (*Site) GetDoor

func (s *Site) GetDoor(doorID uint64) *Door

func (*Site) GetDoors

func (s *Site) GetDoors() map[uint64]*Door

func (*Site) GetMonitoredDoors

func (s *Site) GetMonitoredDoors() map[uint64]*Door

func (*Site) GetOpenableDoors

func (s *Site) GetOpenableDoors() map[string][]config.DoorSequence

func (*Site) GetStaff

func (s *Site) GetStaff() map[int]*User

func (*Site) GetTodaysActiveUsersInDepartment

func (s *Site) GetTodaysActiveUsersInDepartment(match func(test Department) bool) map[int]*User

func (*Site) GetUser

func (s *Site) GetUser(userID int) *User

func (*Site) GetUserPicture

func (s *Site) GetUserPicture(userID int) ([]byte, error)

func (*Site) GetUserPictureByLocalID

func (s *Site) GetUserPictureByLocalID(localID int) ([]byte, error)

func (*Site) GetUsers

func (s *Site) GetUsers() map[int]*User

func (*Site) GetUsersInDepartment

func (s *Site) GetUsersInDepartment(departmentMatch func(test Department) bool, userMatch func(test *User) bool) map[int]*User

func (*Site) GetVisitors

func (s *Site) GetVisitors() map[int]*User

func (*Site) OpenDoor

func (s *Site) OpenDoor(doorID uint64) error

func (*Site) OpenDoorWithRelay

func (s *Site) OpenDoorWithRelay(doorID uint64, secondRelay bool) error

func (*Site) RemoveUserAccessLevel

func (s *Site) RemoveUserAccessLevel(userID int, accesslevel int) error

func (*Site) ResetAntiPassback

func (s *Site) ResetAntiPassback(userID int) error

func (*Site) SequenceDoor

func (s *Site) SequenceDoor(items ...DoorSequenceItem)

func (*Site) SetUserAccessLevel

func (s *Site) SetUserAccessLevel(userID int, accesslevel int) error

func (*Site) Start

func (s *Site) Start() error

func (*Site) Stop

func (s *Site) Stop()

func (*Site) UpdateAccessLevels

func (s *Site) UpdateAccessLevels() error

func (*Site) UpdateAll

func (s *Site) UpdateAll()

func (*Site) UpdateDepartments

func (s *Site) UpdateDepartments() error

func (*Site) UpdateDoors

func (s *Site) UpdateDoors() error

func (*Site) UpdateUser

func (s *Site) UpdateUser(userID int) error

func (*Site) UpdateUserAccessLevel

func (s *Site) UpdateUserAccessLevel(userID int, accesslevel int) error

func (*Site) UpdateUserAccessLevels

func (s *Site) UpdateUserAccessLevels(userID int, accesslevels []int) error

func (*Site) UpdateUserInfo

func (s *Site) UpdateUserInfo(userID int, info map[string]interface{}) error

func (*Site) UpdateUserNameAndExpiryAndAccessLevel

func (s *Site) UpdateUserNameAndExpiryAndAccessLevel(userid int, firstname string, surname string, expiry time.Time, level int) error

func (*Site) UpdateUsers

func (s *Site) UpdateUsers() error

type SiteManager

type SiteManager struct {
	Logger *zerolog.Logger
	// contains filtered or unexported fields
}

func (*SiteManager) Count

func (m *SiteManager) Count() int

func (*SiteManager) GetSite

func (m *SiteManager) GetSite(id int) *Site

func (*SiteManager) GetSites

func (m *SiteManager) GetSites() map[int]*Site

func (*SiteManager) Start

func (m *SiteManager) Start(sites []*Site) error

func (*SiteManager) Stop

func (m *SiteManager) Stop()

func (*SiteManager) UpdateAll

func (m *SiteManager) UpdateAll()

type User

type User struct {
	GUID              string            `json:"UserGUID"`
	ID                int               `json:"id"`
	Activated         time.Time         `json:"activateDate"`
	Expiry            time.Time         `json:"expiryDate"`
	FirstName         string            `json:"firstName"`
	Surname           string            `json:"lastName"`
	Custom            []UserCustomField `json:"customFields,omitempty"`
	PIN               string            `json:"pin"`
	Departments       []Department      `json:"department"`
	LocalID           string
	LastKnownLocation string
	LastUpdated       time.Time
	AccessLevels      []string
}

type UserCustomField

type UserCustomField struct {
	ID    int    `json:"id"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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