Git Product home page Git Product logo

tcmaker-keyfobs's People

Contributors

vandahm avatar

Stargazers

 avatar

Watchers

 avatar

tcmaker-keyfobs's Issues

Update Keyfobs plugin to work with future door controller

The following SQS Schema is proposed for new messages.

See https://github.com/tcmaker/access_control/blob/master/doc/tcdoor-spec.md for the larger picture.

Add Credential
{
    "action" : "activate",
    "code" : "codenumber",                           //string, not integer
    "facility" : "frontdoor",
    "codetype" : "fob",                              //"fob" or "passcode"
    "member": "3870",                                //string or int
    "priority":  3,                                  //integer
    "tag":  "d2f3ce26-12ab-4b2a-8943-d49e4a7b1420",
    "effective" : "ISO8601 UTC Time",
    "expiration" : "ISO8601 UTC Time"             
}

Note: @rrotter requests we enforce a maximum duration of a credential, rejecting all credentials where the expiration is later than e.g. a week after the effective date, as a fail-safe, thus requiring a user be occasionally re-activated by the membership systems, each reactivation overlapping with the previous. I have no opposition to such a requirement.

Revoke Credential
{
    "action": "revoke",
    "facility" : "facilityname",
    "tag" : "f2151449-113e-4e2c-8c7d-fcecafd8b9d8"
}

Modify Credential

Change all of a memberid's credentials, to replace a keyfob, for example

{
    "action": "modify",
    "facility" : "name",    
    "member" : "memberId", 
    "oldtype": "fob",          //"fob" or "passcode"
    "oldcode": "numbers",    
    "newtype" : "fob",         //"fob" or "passcode"
    "newcode" : "newnumbers"    
}
Set Requirement
{
    "action": "set-requirement",
    "requiredpriority" : 1,                          //integer
    "facility" : "frontdoor",
    "tag" : "556aba4d-4d5f-4779-a914-d80e73b2696b",
    "description" : "desc",                         //optional, for convenience
    "timespec" : "SEE BELOW"
}

For timespec, one of the following values SHALL be used:

  • always
  • A full iCalendar definition. The system will parse the icalendar event information for repeating
    events, e.g. open house. Hopefully this will make integration with clubhouse or admin panels for classes or whatnot straight-forward.
Revoke Requirement
{
    "action": "revoke-requirement",
    "facility" : "facilityname",
    "tag" : "192f0827-3a9c-41f1-a7e1-5446340a744a"
}

In CRM/Keyfobs/BAO/Keyfob.php lives the current activate and deactivate functions:

A short-term workaround may work to eliminate the deactivation functionality, and update the activate to compute a fob expiration time, and send using that. The door controller will not mind duplicate credentials.

public function deactivate() {
// You can't deactivate a code that doesn't exist
if (! $this->code) {
return;
}
$message = array(
'action' => 'deactivate',
'code' => $this->code,
'member' => (int)$this->contact_id,
'access_level' => 0,
);
$this->getSqsClient()->sendMessage(array(
'QueueUrl' => Civi::settings()->get('keyfobs_aws_sqs_queue_url'),
'MessageBody' => json_encode($message),
'MessageGroupId' => 'DoorMessages',
'MessageDeduplicationId' => uniqid($more_entropy=true),
));
}
public function activate() {
// Don't activate unless a code is present.
if (! $this->code) {
return;
}
$message = array(
'action' => 'activate',
'code' => $this->code,
'member' => (int)$this->contact_id,
'access_level' => (int)$this->access_level,
);
$this->getSqsClient()->sendMessage(array(
'QueueUrl' => Civi::settings()->get('keyfobs_aws_sqs_queue_url'),
'MessageBody' => json_encode($message),
'MessageGroupId' => 'DoorMessages',
'MessageDeduplicationId' => uniqid($more_entropy=true),
));
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.