KMP PHP API Reference

PermissionsTable extends BaseTable
in package

PermissionsTable - KMP RBAC Permission Management

Manages permission data for the RBAC system. Handles permission-role relationships, policy framework integration, and activity linkage.

Tags
@method

\App\Model\Entity\Permission get(mixed $primaryKey, ...)

Table of Contents

Constants

CACHE_GROUPS_TO_CLEAR  = ['security']
CACHES_TO_CLEAR  = []
Cache configuration for permission-related data
ID_CACHES_TO_CLEAR  = []

Properties

$PermissionPolicies  : PermissionPoliciesTable|HasMany
$Roles  : RolesTable|BelongsToMany

Methods

addBranchScopeQuery()  : SelectQuery
Add branch-based data scoping to a query.
afterDelete()  : void
After delete hook to capture impersonation audit trail entries.
afterSave()  : void
After-save handler for automatic cache invalidation.
buildRules()  : RulesChecker
Business rules for permission data integrity
initialize()  : void
Initialize method - Configures permission table associations and behaviors
newEmptyEntity()  : Permission
validationDefault()  : Validator
Default validation rules for permission data
logImpersonationAction()  : void
Record impersonated writes to audit log table.

Constants

CACHE_GROUPS_TO_CLEAR

protected array<string|int, string> CACHE_GROUPS_TO_CLEAR = ['security']

Cache groups to clear entirely on save

CACHES_TO_CLEAR

Cache configuration for permission-related data

protected array<string|int, array{string, string}> CACHES_TO_CLEAR = []

Permissions are at the core of the authorization system, so changes need to trigger appropriate cache invalidation to ensure security decisions are based on current data.

Static cache entries to clear on save

ID_CACHES_TO_CLEAR

protected array<string|int, array{string, string}> ID_CACHES_TO_CLEAR = []

Entity-ID cache prefixes to clear on save

Properties

Methods

addBranchScopeQuery()

Add branch-based data scoping to a query.

public addBranchScopeQuery(SelectQuery $query, array<string|int, int> $branchIDs) : SelectQuery

Child tables should override for custom branch relationships.

Parameters
$query : SelectQuery

The query to modify

$branchIDs : array<string|int, int>

Authorized branch IDs

Return values
SelectQuery

Query with branch filtering

afterDelete()

After delete hook to capture impersonation audit trail entries.

public afterDelete(EventInterface $event, EntityInterface $entity, ArrayObject $options) : void
Parameters
$event : EventInterface

Delete event

$entity : EntityInterface

Entity being deleted

$options : ArrayObject

Delete options

afterSave()

After-save handler for automatic cache invalidation.

public afterSave(EventInterface $event, EntityInterface $entity, ArrayObject $options) : void
Parameters
$event : EventInterface

The afterSave event

$entity : EntityInterface

The saved entity

$options : ArrayObject

Save options

buildRules()

Business rules for permission data integrity

public buildRules(RulesChecker $rules) : RulesChecker

Currently no custom business rules are implemented beyond validation, but this method provides the framework for adding complex business logic constraints in the future.

Parameters
$rules : RulesChecker

The rules object to be modified.

Return values
RulesChecker

initialize()

Initialize method - Configures permission table associations and behaviors

public initialize(array<string, mixed> $config) : void

Sets up the permission management infrastructure including role associations, policy framework integration, and activity linkage for the KMP RBAC system.

Parameters
$config : array<string, mixed>

The configuration for the Table.

validationDefault()

Default validation rules for permission data

public validationDefault(Validator $validator) : Validator

Implements comprehensive validation for permission creation and updates, ensuring data integrity and proper permission configuration.

Parameters
$validator : Validator

Validator instance.

Return values
Validator

logImpersonationAction()

Record impersonated writes to audit log table.

protected logImpersonationAction(string $defaultOperation, EntityInterface $entity) : void
Parameters
$defaultOperation : string

Operation fallback (save/delete)

$entity : EntityInterface

Affected entity


        
On this page

Search results