Security Reference Public

Administration

Administer the ERPat Security module — the single always-on module_security setting, the eight permission groups covering Device Management, Offsite Access, Locked Accounts, Active Sessions and Access Logs, the four-item Security menu, and audit logging of every sensitive action.

Guide version: r3 Module version: 1.5.0 Updated: 2026-08-28 Estimated time: 12 min 10 views 0% helpful
Administration & Reference

Administration

How the module is enabled, who can do what across its four tools, and how every sensitive action is recorded. This is the control panel for the whole Security section.

Enablement model

Security has exactly one enable setting, and it is always on. There are no sub-toggles: each of the four tools underneath it is controlled purely by permissions.

SettingDefaultControlsCan turn off?
module_security the only one On (seeded) Whether the Security module and its whole menu slice are available — Device Management, Offsite Access, Locked Accounts & Active Sessions, and Access Device Logs. Nocan_disable = false. It is listed in Manage Modules but has no disable switch, so the Security tools are always present.
ℹ️
The old sub-toggles are gone. Earlier releases shipped extra on/off switches that hid single menu items — module_offsite_access, module_access (both retired in 2.0.0) and module_device_management (retired in 3.0.0). All three have been folded into module_security and no longer appear as their own rows in Settings → Manage Modules. Nothing to do on upgrade: a tool that was switched on before stays on, and its permission grants are untouched.
????
Why Security cannot be switched off. These are safety tools — unlocking a locked-out administrator, ending a rogue session, closing an offsite window, lifting a device ban. If the module could be switched off, those levers could vanish exactly when you need them. So module_security is seeded on and cannot be disabled.
????
To hide a tool, take away its permission. Since the toggles are gone, visibility is entirely a role decision: a staff member sees a Security menu item only if their role holds that item's permission (administrators always see all four). Revoke the permission and both the menu item and the page disappear for that role.

The tooling / protection-layer boundary

This module is the admin tooling. The protection layer it operates on stays in ERPat core — do not expect to configure guards, middleware, or RBAC inside this module:

ControlWhere it livesThis module's relationship
Authentication guardsCore (application/guards/)Not owned here.
Request middleware (secure headers, input sanitization, CSRF, rate-limit, IP restriction, file security)Core (application/middleware/)The IP-restriction middleware reads this module's Offsite Access grants.
Roles / permissions RBAC editorCore (Settings → Roles)This module contributes its eight permission groups into it.
System audit logCore (system_logs)This module writes to it on every sensitive action.
Office-IP whitelistCore IP-restriction settingsOffsite Access grants are time-boxed exceptions to it.
Sign-in (authentication)Core sign-in, running the checks modules register with itThis module registers the banned-device check that core runs on every sign-in attempt — that is how a Device Management ban takes effect. See The sign-in check below.

The sign-in check

A Device Management ban is enforced during sign-in itself — not by anything on the Security screens. The way that happens changed in this release, and while nothing about it needs configuring, two of its properties are worth understanding before you troubleshoot a sign-in problem.

The module now ships a small declaration file (config/auth_checks.php) that registers its banned-device check with ERPat's sign-in machinery. Core no longer reaches into this module by name; it simply runs whichever checks the installed modules have registered. Practically, that means the ban check travels with the module — there is nothing to wire up, and nothing in core to keep in step.

PropertyHow it behavesWhy it matters to you
Where it comes from Declared by this module in config/auth_checks.php Ships with the module. Nothing to switch on, nothing to configure.
When it runs Every sign-in attempt, before the password is compared A banned device is turned away without using up one of the person's three login attempts, so a ban never drags anyone towards a lockout. The attempt is recorded separately as a banned-device attempt.
Can it be switched off? No — deliberately not tied to module_security An enforcement check must not be disableable. See below.
If it cannot run Sign-in is denied and the reason is written to the error log It fails safe rather than silently letting banned devices through. See below.
????
The ban check has no on/off switch — on purpose. Every other part of this module — its pages, its menu items, its permissions — sits under module_security. The sign-in check deliberately does not. A setting that could stop a ban being enforced would be an authentication bypass dressed up as a settings toggle: anyone who could reach Manage Modules could quietly let every banned device back in, with no trace on the Security screens. Since module_security is locked on (can_disable = false) there was never a legitimate way to turn it off anyway — this removes the possibility entirely.
????
If the check cannot run, sign-in is refused — it never fails quietly. A security check that stops running without saying so is worse than one that breaks loudly: your bans would look completely intact on screen while every banned device sailed straight through, and nothing would tell you. So the check fails closed — if it cannot be carried out, the sign-in is denied and the reason is written to the application error log (logs/log-YYYY-MM-DD.php). A sudden, unexplained "nobody can sign in" is therefore a diagnosable event, and the log is where the answer is.
????️
What that looks like in practice. The check needs the banned_devices table to answer its question. Fresh installations and newly provisioned tenants get that table from the standard database schema, and the module's migrations re-create it wherever it is missing — so on a healthy database there is nothing to do. If a particular database is missing it, every sign-in on that database is refused and each attempt logs "banned_devices is missing … run php erpat migrate:modules". Running the module migrations against that database is the fix, and it takes effect immediately. Worth checking after restoring an old backup or bringing up a tenant by hand.
????
Telling the two failures apart. A genuine ban shows the user a device is restricted message and does not count against their login attempts. A fail-closed refusal is deliberately indiscriminate: the user just sees the ordinary authentication failed message, and it does count against their attempts — so repeated tries will lock the account after three. If several people report being locked out at once shortly after a database change, read the error log before clearing attempts, or they will simply lock themselves out again.

Permissions

The Roles editor gains eight permission groups from this module — four Device Management groups and four Security groups. The keys are unchanged from before each feature was modularized, so existing role grants keep working; only device_management is new (see below). They are listed here in menu order.

Group (Roles editor)KeysStyleGoverns
Device Management: Module new in 3.0.0 device_management Access (module-level) Opening the Device Management page at all — both the menu link and the direct web address. Without it, the whole tool is invisible and unreachable.
Device Management: Groups device_management_groups, device_management_groups_create, device_management_groups_update, device_management_groups_delete Enabled (module-level) The Groups tab — creating, editing and removing the named device (user-agent) groups used to label and filter the Entries list.
Device Management: Block Device block_device Enabled (no children) Banning a device, so that person can no longer sign in from that browser.
Device Management: Unblock Device unblock_device Enabled (no children) Restoring a banned device so the person can sign in from it again.
Security: Offsite Access offsite_access, offsite_access_create, offsite_access_update, offsite_access_delete Dropdown — All / Specific members Viewing and managing offsite grants; "Specific" scopes the list to allowed members.
Security: Locked Accounts locked_accounts Simple View (no children) Opening the Locked Accounts page and clearing failed attempts. The core staff_support permit also grants entry.
Security: Active Sessions active_sessions, active_sessions_create, active_sessions_update, active_sessions_delete Manage (module-level) Viewing and terminating live login sessions.
Security: Access Logs access_logs, access_logs_create, access_logs_update, access_logs_delete Enabled (module-level) The whole Access Device Logs page — Logs, Devices, and Categories tabs.
????
Least privilege. Give HR / support just Locked Accounts so they can rescue lockouts. Reserve Device Management, Offsite Access, Active Sessions, and Access Logs for IT/admin roles. Set the Offsite Access permit to Specific when a manager should only manage grants for their own team. Blocking and unblocking are deliberately separate permits — a help-desk role can be given Unblock Device alone, so it can free a colleague who has been shut out without also being able to lock anyone out.
????
Administrators bypass every check. An admin account sees and can use all four tools regardless of what its role grants — so use a non-admin test account when you want to confirm that a role's permissions are set the way you intended.

What changed for Device Management in 3.0.0

Device Management used to be a core ERPat feature sitting in the Security menu group. In 3.0.0 it moved into this module and became its fourth tool. Three things changed that administrators need to know about:

  1. Opening the page now requires a permission. Before 3.0.0 the page had no gate on the direct web address — any signed-in staff member who typed the address could open it, and only the menu link was hidden. Worse, that menu link checked a permission that no role could actually be given, so in practice the tool was administrators-only. Now the Device Management: Module permission genuinely exists: it is enforced on the page itself, and it can be granted to a role.
  2. Its enable toggle was retired. The old module_device_management setting is gone; the tool is now covered by the always-on module_security setting, so it no longer has its own row in Settings → Manage Modules. Visibility is purely a permission decision. On a brand-new tenant the tool used to ship switched off, so nobody could open it; it now ships reachable by administrators, and by any role you explicitly grant the permission. No non-admin gains access on upgrade.
  3. Banning and restoring a device are now recorded. Both actions were previously silent. They now land in the tenant's audit log — see Audit logging below.
⚠️
Upgrade promptly. Two flaws in the migrated code that let specially crafted input reach the database directly were fixed as part of the move. One of them could be triggered before anyone signed in, through the browser-identification text a visitor's browser sends to the sign-in page. Nothing needs configuring — the fixes ship with 3.0.0.
????
A ban is narrow on purpose. Banning blocks one person on one browser. It does not disable their account, and it does not touch their other browsers or devices — those still sign in normally. Device groups are only labels for filtering the list; a group grants nothing and blocks nothing.

The Security menu group

The module contributes the whole Security sidebar section — four items, in this order. Device Management was previously a separate core item sharing this group; since 3.0.0 it belongs to this module like the other three. Every item is now gated by a permission alone, with no setting to check.

ItemIconURLGated by
Device Managementfa-mobiledevice_managementperm device_management
Offsite Accessfa-globeoffsite_accessperm offsite_access
Locked Accountsfa-shieldLocked_Accountsperm locked_accounts
Access Logsfa-historyaccess_logsperm access_logs

The Groups tab of Device Management lives at its own address (device_management_groups) and is reached from the page's second tab rather than from a menu item of its own.

Each item also ships a hover description (its nav_desc_* line) for the smart sidebar and the Left Menu Customization editor. "Restore to default" reproduces exactly this four-item slice under the Security header.

Audit logging

Every sensitive action in the module writes to the tenant's own system audit log, categorized Security. Nothing sensitive happens silently. The events, with their severities — the Device Management rows are new in 3.0.0, where those actions were previously not recorded at all:

ActionSeverityLogged as
Device banned new in 3.0.0critical"A user's sign-in device was banned"
Device ban lifted (restored) new in 3.0.0warning"A user's sign-in device ban was lifted"
Device group created / updated new in 3.0.0info"Device management group was created / updated"
Device group deleted new in 3.0.0warning"Device management group was deleted"
Offsite window granted / updated / revokedwarning"Offsite access window was granted / updated / revoked"
Account unlocked (attempts cleared)warning"Account was unlocked (failed login attempts cleared)"
All sessions terminated for a userwarning"All active sessions for a user were terminated"
Single session terminatedwarning"A single active session was terminated"
Access device registered / updatedinfo"Access device was registered / updated"
Access device deletedwarning"Access device was deleted"
Device API secret regeneratedcritical"Access device API secret was regenerated"
Device category created / updated / deletedinfo / warning"Access device category was created / updated / deleted"
Access log entry deletedwarning"Access log entry was deleted"
????
Secrets are never logged. When a device is created or its secret rotated, the API secret value is not written to the audit log — only the fact that it happened, and which device. Secrets are stored hashed at rest.
????
Why banning is logged as critical. A ban stops a colleague signing in from the browser they use every day, so it is treated as the most serious action in this module. The Remarks you are required to type when banning is stored with the ban, alongside who applied it and when — write a reason a reviewer will still understand months later.

Next steps

Was this guide helpful?

Report a content problem