Permissions & Access Control
Entries enforces two-stage Role-Based Access Control (RBAC) plus field-level ACLs and two-tier locking so you can grant focused access to editors while protecting sensitive data and schema tools. Superusers always bypass permission checks.
Stage 1: Module-level permissions
Section titled “Stage 1: Module-level permissions”Installing Entries (with ProcessEntries) creates three ProcessWire permissions under Access -> Permissions:
| Permission | Scope |
|---|---|
entries-single |
Access and edit Single blueprints under Setup -> Entries -> Singles |
entries-collection |
Access and edit Collection blueprints under Setup -> Entries -> Collections |
entries-admin |
Full workspace access including Blueprint Schemas, Managed Tables, Health & Index, Activity Log, Transfer & Seed, and exports |
Assign these permissions to staff roles under Access -> Roles.
Stage 2: Per-blueprint permissions
Section titled “Stage 2: Per-blueprint permissions”Narrow access for any individual blueprint with a permission string or an action-scoped permissions: map:
title: Charter Rateskind: collectionpermission: rates-viewpermissions: view: rates-view create: rates-edit edit: rates-edit delete: rates-admin export: rates-adminThe same policy applies to embedded @fieldset:* and pivot schemas edited via FieldtypeEntries on ProcessWire pages, as well as non-CLI exports (CSV, JSON, ZIP).
Field-level permissions and sensitive fields
Section titled “Field-level permissions and sensitive fields”Restrict individual fields by role or permission directly inside fields::
fields: internal_cost: type: float label: Internal Cost viewRoles: [finance, manager] editRoles: [finance]
webhook_secret: type: secret label: Webhook Secret permission: entries-admin sensitive: true- Users who match
viewRolesbut noteditRolessee the field in read-only mode. - Fields marked
sensitive: true(ortype: secret) are masked in tables, redacted in revision snapshots and draft preview tokens, and omitted from non-privileged exports.
Two-tier locking
Section titled “Two-tier locking”Entries supports locking at both the schema level and the individual record level:
- Tier 1 (Blueprint-level lock): Set
locked: trueon a blueprint to make every record of that blueprint read-only ($item->isBlueprintLocked()). - Tier 2 (Record-level lock): Add
EntryItem::STATUS_LOCKED(16) to an individual record ($item->isLocked()). Locked records cannot be edited, trashed, or deleted until unlocked by an authorized user.
Optimistic concurrency control and error codes
Section titled “Optimistic concurrency control and error codes”Guard against lost updates when two editors or background jobs update the same record simultaneously by passing the loaded modified timestamp to setExpectedModified():
<?php
declare(strict_types=1);
namespace ProcessWire;
use Totoglu\Entries\Storage\EntryRepository;
$entries = $this->wire()->entries;$season = $entries->findOne('type=seasons, code=HIGH_2026');
if ($season !== null) { $season->setExpectedModified($season->modified); $season->set('rate_multiplier', 1.55);
try { $entries->save($season); } catch (WireException $e) { if ($e->getCode() === EntryRepository::ERR_CONFLICT) { // Another user updated this record first } }}| Constant | Code | Trigger |
|---|---|---|
EntryRepository::ERR_INVALID_PARENT |
2001 |
Invalid parent_id, self-parenting, or exceeding 2-level hierarchy depth |
EntryRepository::ERR_DUPLICATE_VALUE |
2002 |
Violation of a blueprint unique constraint |
EntryRepository::ERR_VALIDATION_FAILED |
2003 |
Field validation or custom EntryItem::validate() failure |
EntryRepository::ERR_REFERENCE_RESTRICTED |
2004 |
Deleting a restrictOnDelete: true entry that is still referenced |
EntryRepository::ERR_LOCKED_ITEM |
2005 |
Trashing a locked entry (STATUS_LOCKED or blueprint->locked) |
EntryRepository::ERR_CONFLICT |
4092 |
Optimistic concurrency conflict via setExpectedModified() |
Checking permissions in PHP
Section titled “Checking permissions in PHP”<?php
declare(strict_types=1);
namespace ProcessWire;
$entries = $this->wire()->entries;
// Boolean capability checkif ($entries->can('rates', 'publish')) { // Allowed to publish rates}
// Throw 403 WirePermissionException if unauthorized$blueprint = $entries->registry()->get('rates');if ($blueprint !== null) { $entries->assertPermission($blueprint);}$entries->assertAdminPermission();