# Gate access control for vehicles and visitors

> How to log every vehicle and visitor at a gate with Vigil. Guards scan the licence disc and driver's licence, and each entry is matched to its exit.

Source: https://vigilsecure.net/docs/examples/gate-access-control/

**The scenario.** A guard at the boom of an estate or a business park has to log every
vehicle and visitor that goes in and out. The paper register is slow, hard to read and
impossible to search when the client asks who was on site last Tuesday night.

## How Vigil represents it

| The real world                                | In Vigil                                                                                        |
| --------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| The gate                                      | A group chat, such as `Rosebank main gate`, with the gate guards, their supervisor and an agent |
| The guard at the boom                         | The user signed in on the gate's [device](https://vigilsecure.net/docs/concepts/devices.md)                              |
| A vehicle arriving or leaving                 | A **vehicle** message with a direction: in or out                                               |
| A pedestrian arriving or leaving              | A **person** message with a direction: in or out                                                |
| The licence disc, ID card or driver's licence | Scanned by the device's camera into the message                                                 |
| The register                                  | The chat itself, in order, with a time and a guard's name on every entry                        |
| "How long were they here?"                    | The link Vigil makes between an exit and its entry                                              |

## Set it up

1. [Link a device](https://vigilsecure.net/docs/concepts/devices.md#link-a-device) and name it after the gate.
2. In **Communication**, create a group for the gate. Add the supervisors who should see
   the traffic, and an agent if you want summaries or alerts. Add the agent when you create
   the group.
3. The guards who work the gate are added to the group. They open it on the device at the
   start of their shift.

One chat per gate keeps each gate's register separate and in order.

## What happens at the gate

### A vehicle comes in

1. The guard opens the gate chat, chooses **+**, then **Vehicle**, and leaves the direction
   on **In**.
2. **Scan licence disc.** The guard holds the device against the windscreen. The barcode on
   the disc fills in the plate, make, model, colour and the disc's expiry date.
3. **Scan driver's ID or licence.** The barcode on a South African ID card or driver's
   licence fills in the driver's details.
4. If there are passengers, the guard sets how many and can scan their documents too.
5. The guard enters the **Reason for visit**, such as `Delivery for unit 14`, and can take
   photos of the load, the plate or existing damage.
6. **Send vehicle in.**

The chat shows a **Vehicle in** card with the plate, the driver, the number of passengers
and the reason. An expired licence disc or driver's licence is flagged on the card.

### The vehicle leaves

The guard chooses **Vehicle**, switches to **Out** and scans the disc. Vigil finds the
entry for that plate, if it was within the past 48 hours, and fills in the driver and
passengers from it, so the guard only confirms. The **Vehicle out** card shows when the vehicle came in and how long it was on
site.

### A person on foot

The guard chooses **Person**, scans their ID card or driver's licence, adds a reason and a
photo, and sends it. Leaving works the same way as for a vehicle.

### When there is nothing to scan

A foreign vehicle, a damaged disc or a visitor with a passport can be typed instead:
**Type the plate instead**, or a passport or other document number. The card marks typed
details as **Typed, not scanned**, so you can tell them from scanned ones.

## Use the record

Because every entry is stored as details, not only as words, an agent can answer questions
and build reports from it:

- "Which vehicles are on site right now?"
- "Was CA 123-456 here last week, and for how long each time?"
- "Publish a report of all contractor visits in November, with entry and exit times."
- "Tell me in the managers' chat when a vehicle with an expired disc comes in."

An agent in the gate chat can read the register, but an entry does not wake it: in a group
an agent is woken only when somebody mentions it. For alerts, ask the agent to review the
gate chat on a schedule, such as every fifteen minutes.

## Privacy

Gate records hold personal information about visitors. In Vigil they are visible only to
the participants of the gate chat and to agents in it. Add only the people who need them,
and share reports with a client through an artifact's
[share link](https://vigilsecure.net/docs/concepts/artifacts.md#share-an-artifact-with-a-client), which you can
expire and revoke.

## Related

- [Communication](https://vigilsecure.net/docs/concepts/communication.md)
- [The guard app](https://vigilsecure.net/docs/concepts/guard-app.md)
