Skip to content

Punching only on the devices a person is set up for

The rule

Each person punches on the devices they are set up for: the clock at their site, and for some the phone app or a web page. A punch made anywhere else (a phone, for someone who is to clock in on site) is flagged for a supervisor to look at. The time still counts: the person worked it, and the flag is for asking why.

Who uses it

Employers with some people on site and some in the field: warehouses and plants whose drivers or technicians punch from a phone, retailers that let managers punch from a web page, and anyone who turns on a phone app for some people and not others.

How the recipe does it

Every punch records the device it was made on: a clock’s id, or the id a phone app or web page gives itself (mobile, web). Each person’s employment attribute devices lists the devices they punch on, as text separated by commas ("mobile, web, CG1") or as a list.

Configuration only: a package (package.toml) of one layer running the standard device_allowed step, in the pair stage, which reads each workday’s punches before they are paired.

[[layer]]
id = "devices"
[[layer.step]]
id = "devices"
uses = "standard/device_allowed"
params = { attribute = "devices", kind = "device_not_allowed" }

A punch on a device the attribute does not list raises a device_not_allowed exception about the punch, saying which device. A person without the attribute may punch on any device.

Parameters

StepParameterMeaning
devicesattributeThe employment attribute that lists the person’s devices (devices).
deviceskindThe exception raised (device_not_allowed).

What the scenarios show

  • a-phone-punch-for-someone-on-site: a clock-in from a phone by someone set up only for the dock clock is flagged, and the day’s hours count.
  • a-field-worker-may-use-the-phone: someone set up for the phone, the web page and the clock raises nothing on any of them.

Time worked must be paid wherever it was punched: the flag asks why, it does not take the time away. Check what the law where you operate says about tracking where people punch from (a phone’s location is personal data in many places).

Get the recipe

The recipe’s package and its scenarios are in the example packages repository: attendance/device_allowed_by_attribute. Test it, or your own copy of it, with hourctl attend test, and publish it with hourctl attend pkg publish.

The policy package

The package’s layers, with the standard steps each one runs and their settings:

device_allowed_by_attribute/package.toml
name = "device_allowed_by_attribute"
version = "1.0.0"
description = "A punch made on a device the person is not set up to use (a phone, when they are to clock in on site) is flagged for a supervisor, and still counts."
# Each person's employment attribute `devices` lists the devices they
# punch on; a punch on another is flagged.
[[layer]]
id = "devices"
[[layer.step]]
id = "devices"
uses = "standard/device_allowed"
params = { attribute = "devices", kind = "device_not_allowed" }

Scenarios

Each scenario gives a person’s punches and setup and the timecard they must produce, worked out with this package adopted (the format).

A field technician is set up for the phone app and the web page as well as the office clock (devices = "mobile, web, CG1"): punches from the phone and the web page raise nothing
scenarios/a-field-worker-may-use-the-phone.toml
description = "A field technician is set up for the phone app and the web page as well as the office clock (devices = \"mobile, web, CG1\"): punches from the phone and the web page raise nothing"
punch = [
{ at = "2026-10-05 08:00", kind = "in", device = "mobile" }, { at = "2026-10-05 16:00", kind = "out", device = "web" },
{ at = "2026-10-06 08:00", kind = "in", device = "CG1" }, { at = "2026-10-06 16:00", kind = "out", device = "mobile" },
]
[policy]
zone = "America/Chicago"
[[employment]]
effective = "2026-01-05"
kind = "hired"
attributes = { devices = "mobile, web, CG1" }
[expect]
week = "2026-10-05"
days = { "2026-10-05" = "8h", "2026-10-06" = "8h" }
exceptions = []
A warehouse worker set up to punch at the dock clock (devices = "CG1") clocks in from their phone on Tuesday: the punch is flagged device_not_allowed for a supervisor, and the day's 8 hours count all the same. Monday, at the clock, raises nothing
scenarios/a-phone-punch-for-someone-on-site.toml
description = "A warehouse worker set up to punch at the dock clock (devices = \"CG1\") clocks in from their phone on Tuesday: the punch is flagged device_not_allowed for a supervisor, and the day's 8 hours count all the same. Monday, at the clock, raises nothing"
punch = [
{ at = "2026-10-05 08:00", kind = "in", device = "CG1" }, { at = "2026-10-05 16:00", kind = "out", device = "CG1" },
{ at = "2026-10-06 07:40", kind = "in", device = "mobile" }, { at = "2026-10-06 15:40", kind = "out", device = "CG1" },
]
[policy]
zone = "America/Chicago"
[[employment]]
effective = "2026-01-05"
kind = "hired"
attributes = { devices = "CG1" }
[expect]
week = "2026-10-05"
days = { "2026-10-05" = "8h", "2026-10-06" = "8h" }
exceptions = [
{ kind = "device_not_allowed", at = "2026-10-06 07:40", detail = "made on mobile, which devices does not list" },
]