Documentation ¶
Index ¶
- Constants
- type EventLogPayload
- type HeartBeat
- type ResourceManager
- func (rm ResourceManager) CheckStatus(r models.Resource)
- func (rm ResourceManager) DeleteResourceACL()
- func (rm ResourceManager) EnableValidUIDs()
- func (rm *ResourceManager) HealthCheckHandler(client mqtt.Client, msg mqtt.Message)
- func (rm ResourceManager) MQTT() mqtt.MQTTServer
- func (rm *ResourceManager) OnAccessEventHandler(payload models.LogMessage)
- func (rm *ResourceManager) OnHeartBeatHandler(client mqtt.Client, msg mqtt.Message)
- func (rm *ResourceManager) OnRemoveInvalidRequestHandler(client mqtt.Client, msg mqtt.Message)
- func (rm ResourceManager) Open(resource models.Resource)
- func (rm ResourceManager) PushOne(m models.Member)
- func (rm *ResourceManager) ReceiveHandler(client mqtt.Client, msg mqtt.Message)
- func (rm ResourceManager) RemoveMember(memberAccess models.MemberAccess)
- func (rm ResourceManager) RemoveOne(member models.Member)
- func (rm ResourceManager) RemovedInvalidUIDs()
- func (rm ResourceManager) UpdateResourceACL(r models.Resource) error
- func (rm ResourceManager) UpdateResources()
Constants ¶
const ( // StatusGood - the resource is online and up to date StatusGood = iota // StatusOutOfDate - the resource does not have the most up to date information StatusOutOfDate // StatusOffline - the resource is not reachable StatusOffline )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventLogPayload ¶
type EventLogPayload struct { Time int `json:"time"` Username string `json:"username"` RFID string `json:"uid"` Door string `json:"door"` }
{"cmd":"log","type":"access","time":1631240207,"isKnown":"true","access":"Always","username":"Stanley Hash","uid":"f3ec6234","door":"frontdoor"}
type ResourceManager ¶
func New ¶
func New(ms mqttServer, store datastore.DataStore, notifier notifier, logger logger) *ResourceManager
func (ResourceManager) CheckStatus ¶
func (rm ResourceManager) CheckStatus(r models.Resource)
CheckStatus will publish an mqtt command that requests for a specific device to verify that
the resource has the correct and up to date access list It will do this by hashing the list retrieved from the DB and comparing it with the hash that the resource reports
func (ResourceManager) DeleteResourceACL ¶
func (rm ResourceManager) DeleteResourceACL()
func (ResourceManager) EnableValidUIDs ¶
func (rm ResourceManager) EnableValidUIDs()
func (*ResourceManager) HealthCheckHandler ¶
func (rm *ResourceManager) HealthCheckHandler(client mqtt.Client, msg mqtt.Message)
HealthCheck -- this is the mqtt messageHandler that runs when a resource checks in
we expect the payload to be json that marshals to `ACLResponse` which includes the name and a hash of it's ACL if the ACL hash doesn't match what we have in the database, we will trigger an update to push to the resource
func (ResourceManager) MQTT ¶
func (rm ResourceManager) MQTT() mqtt.MQTTServer
func (*ResourceManager) OnAccessEventHandler ¶
func (rm *ResourceManager) OnAccessEventHandler(payload models.LogMessage)
OnAccessEvent - post the event to slack. This could also get shoved in the DB eventually
func (*ResourceManager) OnHeartBeatHandler ¶
func (rm *ResourceManager) OnHeartBeatHandler(client mqtt.Client, msg mqtt.Message)
OnHeartBeat handles heartbeats from
func (*ResourceManager) OnRemoveInvalidRequestHandler ¶
func (rm *ResourceManager) OnRemoveInvalidRequestHandler(client mqtt.Client, msg mqtt.Message)
go through and remove members rfid fobs that are listed as invalid
func (ResourceManager) Open ¶
func (rm ResourceManager) Open(resource models.Resource)
func (ResourceManager) PushOne ¶
func (rm ResourceManager) PushOne(m models.Member)
PushOne - update one user on the resources
func (*ResourceManager) ReceiveHandler ¶
func (rm *ResourceManager) ReceiveHandler(client mqtt.Client, msg mqtt.Message)
func (ResourceManager) RemoveMember ¶
func (rm ResourceManager) RemoveMember(memberAccess models.MemberAccess)
func (ResourceManager) RemoveOne ¶
func (rm ResourceManager) RemoveOne(member models.Member)
RemoveOne - remove a member from all resources
func (ResourceManager) RemovedInvalidUIDs ¶
func (rm ResourceManager) RemovedInvalidUIDs()
func (ResourceManager) UpdateResourceACL ¶
func (rm ResourceManager) UpdateResourceACL(r models.Resource) error
UpdateResourceACL pulls a resource's accesslist from the DB and pushes it to the resource
func (ResourceManager) UpdateResources ¶
func (rm ResourceManager) UpdateResources()
UpdateResources - publish an MQTT message to add a member to the actual device