Security Reference Public

Getting Started

Enable the ERPat Security module, run its migrations, confirm the always-on umbrella setting, and grant the Device Management, Offsite Access, Locked Accounts, Active Sessions, and Access Logs permissions so administrators can start using all four tools.

Guide version: r3 Module version: 1.5.0 Updated: 2026-08-28 Estimated time: 8 min 10 views 0% helpful
Introduction

Getting Started

The Security module is always available — but the individual tools and who can use them still need a little setup. This page takes an administrator from a fresh install to a working Device Management, Offsite Access, Locked Accounts / Active Sessions, and Access Device Logs.

????
Who this is for. An administrator who can reach Settings → Manage Modules and the Roles editor. Day-to-day operators can jump straight to Daily Operations once the steps below are done.

Prerequisites

  • PHP ≥ 8.2 and ERPat core ≥ 1.10.0 — required by the module manifest.
  • Admin access to the Roles editor (Settings → Roles) for granting permissions.
  • Staff users must already exist — Offsite Access windows and access-device passes are assigned to active staff members.
  • Your office IP whitelist should be configured (a core setting) for Offsite Access to be meaningful — a grant is an exception to that whitelist. If no IP restriction is enforced, an offsite grant simply has nothing to relax.
  • People need at least one sign-in before they show up in Device Management — that list is built from sign-in history, so a brand-new account that has never logged in yet has no devices to show.

The module is on by default

Unlike most modules, Security cannot be turned off. Its umbrella setting module_security is seeded on and locked — it is listed in Settings → Manage Modules under the Security category but has no disable switch (can_disable = false). That guarantees the Security tools are always reachable. It is the module's only enable setting — everything below it is controlled by permissions. See Administration for the full map.

????
Upgrading from the old in-app screens? Nothing is lost. Device Management, Offsite Access, Locked Accounts / Active Sessions, and Access Device Logs all previously lived in core; they were relocated into this module with their permission keys unchanged, so existing role grants keep working with no data migration. You do still need to run php erpat migrate:modules on every database — the six backing tables are created by this module's migrations and are not part of the base install. Re-running is always safe.
????
New in 3.0.0 — Device Management is now the module's fourth tool. It moved out of core and is now owned end to end by Security, sitting first in the Security sidebar group. Two things changed for administrators:
  • Opening the page now requires a permission. Previously anyone signed in could reach it by typing the address; now only administrators and roles you explicitly grant Device Management: Module can open it.
  • Its old separate on/off switch is retired — it no longer has its own row in Settings → Manage Modules. Who sees it is now purely a permission decision. On a brand-new tenant that switch used to ship off, so nobody could open the page at all; now administrators can, and anyone else needs the permission granted.
Banning and restoring a device are also written to the audit log now, which they were not before.

Activation — two steps

  1. Run the module migrations

    From the project root. The migrations are idempotent (CREATE-IF-NOT-EXISTS) and are tracked in the module's own migrations_security table. On an existing database they do nothing; on a fresh install or a newly provisioned tenant they create the six tables.

    php erpat migrate:modules
    # (or) php erpat migrate:latest
  2. Grant permissions in Roles

    Go to Settings → Roles and give the right roles the Security permission groups (below). Administrators see everything by default. That's it — there is no module to "switch on".


What the migrations create

Six tables across the feature areas. These migrations are the only thing that creates them — they are not part of the base-install schema, so run php erpat migrate:modules on every database before anyone signs in. Re-running is a safe no-op. Until banned_devices exists, the sign-in device check has nothing to read and refuses sign-in rather than waving devices through, logging the missing table to the server error log:

TableFeatureHolds
banned_devicesDevice ManagementOne row per ban — the person, the browser it applies to, the IP, the reason, and who banned it.
device_management_groupsDevice ManagementEach named device group — title, the browser it matches, status.
offsite_accessOffsite AccessOne row per grant — user, start date, end date.
access_device_categoriesAccess Device LogsDevice category — title, detail, status.
access_devicesAccess Device LogsEach device — name, category, API key/secret, its "passes" (allowed staff), status.
access_logsAccess Device LogsEach access event — device, user, remark, timestamp.

Locked Accounts & Active Sessions has no table of its own — it reads existing columns on the users table (failed-attempt counters) and the core session store (ci_sessions). Device Management's list has no table either — the devices you see are worked out live from sign-in history, and only the bans and the groups are stored. Full schema on the Reference page.


Granting access in Roles

Eight permission groups appear in the Roles editor — four under Device Management: … and four under Security: …. Device Management needs one permission to open the page and separate ones to act on a device. Grant them to the roles that need each tool:

Roles-editor groupBase keyStyleUnlocks
Device Management: Module device_management Access (module-level) Opening the Security → Device Management page at all, and reading the Entries list. New in 3.0.0 — without it the page is closed, even to a direct address.
Device Management: Groups device_management_groups (+ _create / _update / _delete) Enabled (module-level) The Groups tab — creating, editing, and removing named device groups.
Device Management: Block Device block_device Simple Enabled The ban action — stopping a person from signing in on one particular browser.
Device Management: Unblock Device unblock_device Simple Enabled The restore action — lifting a ban so the person can sign in from that browser again.
Security: Offsite Access offsite_access (+ _create / _update / _delete) Dropdown — All / Specific members The Security → Offsite Access page and the grant/edit/revoke actions.
Security: Locked Accounts locked_accounts Simple View The Security → Locked Accounts page (its Browse tab) and the "Clear Attempts" unlock action. (Holders of the core staff_support permit can also reach it.)
Security: Active Sessions active_sessions (+ _create / _update / _delete) Manage (module-level) The session-management capability on the Active Sessions tab — view, terminate a single session, log a user out of all devices.
Security: Access Logs access_logs (+ _create / _update / _delete) Enabled (module-level) The whole Access Device Logs page — all three tabs (Logs, Devices, Categories).
ℹ️
Existing grants keep working. These keys are the same ones the features used before they were moved into the module, so any role grants you already have keep resolving with no re-work. The one addition is Device Management: Module, which is new in 3.0.0 — it is the first time that page can be handed to a non-administrator role, so nobody loses access by upgrading, but nobody gains it either until you grant it. The full key list and how each maps to a screen is on Reference → Permissions.
⚠️
Grant the ban and restore permissions as a pair. Someone who can ban a device but cannot restore one will need to come back to you to undo their own mistake. Unless you deliberately want a two-person rule, give Block Device and Unblock Device to the same roles.

The Security sidebar group

With the permissions granted, a Security section appears in the left sidebar. This module owns all four items in it, in this order:

Menu itemOpensShown when
Device ManagementThe two-tab Device Management page (Entries · Groups).device_management permission.
Offsite AccessThe Offsite Access grants page.offsite_access permission.
Locked AccountsThe two-tab Locked Accounts / Active Sessions page.locked_accounts permission.
Access LogsThe three-tab Access Device Logs page.access_logs permission.
ℹ️
There are no sub-toggles. The module has exactly one enable setting, module_security, and it is always on and cannot be turned off. Every item above is shown or hidden purely by permission — there is no on/off switch anywhere that can hide one of these menu items. If a colleague cannot see one, grant them its permission; that is the only lever.

First-run checklist

????
Purpose: go from a fresh install to a usable Security section.
Who: an administrator.
Preconditions: migrations run, at least one active staff user.
  1. Run the migrations

    php erpat migrate:modules — confirms the six tables exist.

  2. Grant the permission groups

    In Roles, give IT/admin roles Device Management (plus Groups, Block Device and Unblock Device), Offsite Access, Locked Accounts, Active Sessions, and Access Logs. Give HR/support at least Locked Accounts.

  3. Confirm the sidebar

    Reload and check the Security group shows Device Management, Offsite Access, Locked Accounts, and Access Logs. If one is missing, the role is simply missing that item's permission — there is no toggle to check.

  4. Look at one person's devices

    Open Security → Device Management. The list starts empty on purpose — pick a person (or a team) in the filter at the top and the page fills in with the browsers they have signed in from, each with its own status. Don't ban anything yet; this is just to confirm the page works and to see what "one row per person per browser" looks like.

  5. Seed your access-device categories

    Only if you use door/access devices: open Access Logs → Categories and add a category or two before registering devices.

  6. Try one action end-to-end

    Follow a procedure on Daily Operations — e.g. grant a short offsite window to yourself — and confirm it appears in the tenant's audit log.

Next steps

Was this guide helpful?

Report a content problem