LAC-API Examples
What is LAC?
LAC stands for Location Access Control. This API is a limited extension of internal access control systems and is designed to be used to validate pass holder access rights. This LLSA API can actively affect door or gate controls.
Connecting to the LAC-API
The code below will create a PHP SOAP client object that contains all of the LAC-API methods.
$client = new
SoapClient('https://api.skilouise.com/LAC-API.php?WSDL',array('trace'
=> true,'exceptions' => false));
The members API provides the following methods...
- testAccess : Method to test if the given member ID has access to the given location.
- accessLog : Method to record the result of an access attempt.
- getLAC : Method to return an array of location IDs to which the given member ID has access.
- setLAC : Method to grant or remove access to the given location for the given member.
Full Details of LAC-API and its response objects can be found by viewing the WSDL file here.
Log an access attempt
The accessLog method will insert a record in to the access log for the
given pass number at the given location (ID).
The result param is
used to indicate success or failure and should be the value returned from
a call to testAccess. This method is used for logging only and has no
effect on pass status or access rights.
$response = $client->accessLog($apiKey, $password, $locationID,
$passNumber, $result);
The accessLog method will return a responce object with the following values...
- result : Ture if the process was completed.
- locationID : The location ID sent in the request.
- passNumber : The pass number sent in the request.
- dateTime : Date and time returned for the log entry.
Fetching a members location access rights
The getLAC method returns an array containing the location IDs to which the given member ID has been granted access rights. Locations to which the member has no access are excluded from the list. Use the code below to return an array of granted locations.
$response = $client->getLAC($apiKey, $password, $memberID);
The getLAC method will return a response object with the following values...
- result : True if the process was completed.
- memberID : The member ID sent in the request.
- LAC : JSON encoded string containing an array of active locations to which the member has valid access.
Testing Access Rights
To test if a given pass holder has been granted access to a restricted location use the testAccess method as shown below.
$response = $client->testAccess($apiKey, $password, $locationID,
$passNumber);
The testAccess method is a 'real time' check of access rights. The method checks the status of the pass number presented, the status of the location been tested and the members granted permissions. For this method to return a true ( access granted ) result the location must be active, that pass must be active and the attached member must have been granted permission to the location been tested.
The testAccess method returns boolean true on success else false. Use the result from this method in a call to accessLog to record entry as shown below.
$testAccessResult = $client->testAccess($apiKey, $password,
$locationID, $passNumber);
$accessLogResult =
$client->accessLog($apiKey, $password, $locationID, $passNumber,
$testAccessResult);
Setting LAC rights
The setLAC method allows access rights to be assigned to members. This method requires the $locationID and $memberID along with a boolean value for $grant. True grants the permission while false removes it.
Use the code below to grant or remove access rights to the given member ID at the given location
$result = $client->setLAC($apiKey, $password, $memberID, $locationID, $grant)