KMP PHP API Reference

ServicePrincipalAuditLogsTable extends BaseTable
in package

ServicePrincipalAuditLogs Table - API Request Audit Trail

Records all API requests for compliance and debugging.

Table of Contents

Constants

CACHE_GROUPS_TO_CLEAR  = []
CACHES_TO_CLEAR  = []
ID_CACHES_TO_CLEAR  = []

Properties

$ServicePrincipals  : ServicePrincipalsTable|BelongsTo
$ServicePrincipalTokens  : ServicePrincipalTokensTable|BelongsTo

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
Returns a rules checker object.
findForServicePrincipal()  : SelectQuery
Find logs for a specific service principal.
findOrCreate()  : ServicePrincipalAuditLog
findRecent()  : SelectQuery
Find recent logs (last N entries).
get()  : ServicePrincipalAuditLog
initialize()  : void
Initialize method
logRequest()  : ServicePrincipalAuditLog|false
Log an API request.
newEmptyEntity()  : ServicePrincipalAuditLog
newEntity()  : ServicePrincipalAuditLog
patchEntity()  : ServicePrincipalAuditLog
save()  : ServicePrincipalAuditLog|false
saveOrFail()  : ServicePrincipalAuditLog
validationDefault()  : Validator
Default validation rules.
logImpersonationAction()  : void
Record impersonated writes to audit log table.

Constants

CACHE_GROUPS_TO_CLEAR

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

Cache groups to clear entirely on save

CACHES_TO_CLEAR

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

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()

Returns a rules checker object.

public buildRules(RulesChecker $rules) : RulesChecker
Parameters
$rules : RulesChecker

The rules object

Return values
RulesChecker

findForServicePrincipal()

Find logs for a specific service principal.

public findForServicePrincipal(SelectQuery $query, int $servicePrincipalId) : SelectQuery
Parameters
$query : SelectQuery

Query

$servicePrincipalId : int

Service principal ID

Return values
SelectQuery

findRecent()

Find recent logs (last N entries).

public findRecent(SelectQuery $query[, int $limit = 100 ]) : SelectQuery
Parameters
$query : SelectQuery

Query

$limit : int = 100

Number of entries

Return values
SelectQuery

get()

public get(mixed $primaryKey[, array<string|int, mixed>|string $finder = = '\'all\'' ][, CacheInterface|string|null $cache = = 'null' ][, Closure|string|null $cacheKey = = 'null' ], mixed ...$args) : ServicePrincipalAuditLog
Parameters
$primaryKey : mixed
$finder : array<string|int, mixed>|string = = '\'all\''
$cache : CacheInterface|string|null = = 'null'
$cacheKey : Closure|string|null = = 'null'
$args : mixed
Return values
ServicePrincipalAuditLog

initialize()

Initialize method

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

Configuration

logRequest()

Log an API request.

public logRequest(int $servicePrincipalId, int|null $tokenId, string $action, string $endpoint, string $httpMethod[, string|null $ipAddress = null ][, string|null $requestSummary = null ][, int|null $responseCode = null ]) : ServicePrincipalAuditLog|false
Parameters
$servicePrincipalId : int

Service principal ID

$tokenId : int|null

Token ID

$action : string

Action description

$endpoint : string

Endpoint path

$httpMethod : string

HTTP method

$ipAddress : string|null = null

Client IP

$requestSummary : string|null = null

Request summary

$responseCode : int|null = null

Response code

Return values
ServicePrincipalAuditLog|false

validationDefault()

Default validation rules.

public validationDefault(Validator $validator) : Validator
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