ServicePrincipalsController
extends ApiController
in package
Service Principals API Controller
Provides self-service endpoints for service principals.
Table of Contents
Constants
- VIEW_DATA_EVENT = 'KMP.plugins.callForViewData'
- VIEW_PLUGIN_EVENT = 'KMP.plugins.callForViewCells'
Properties
- $isCsvRequest : bool
- $pluginViewCells : array<string|int, mixed>
Methods
- beforeFilter() : Response|null
- Before filter - runs before each action.
- initialize() : void
- Initialization hook.
- isCsvRequest() : bool
- Check if current request is for CSV export.
- me() : void
- Get current service principal details.
- switchView() : Response
- Switch between mobile and desktop view modes.
- apiError() : void
- Standard error response envelope.
- apiSuccess() : void
- Standard success response envelope.
- authorizeCurrentUrl() : void
- Authorize the current URL/action via Authorization component.
- getPaginationMeta() : array<string|int, mixed>
- Build pagination metadata.
- getServicePrincipal() : ServicePrincipal
- Get the authenticated service principal.
- isServicePrincipal() : bool
- Check if current identity is a service principal.
- organizeViewCells() : array<string|int, mixed>
- Organize view cells by type and display order.
Constants
VIEW_DATA_EVENT
public
string
VIEW_DATA_EVENT
= 'KMP.plugins.callForViewData'
Event for plugin view data enhancement
VIEW_PLUGIN_EVENT
public
string
VIEW_PLUGIN_EVENT
= 'KMP.plugins.callForViewCells'
Event for plugin view cell registration
Properties
$isCsvRequest
protected
bool
$isCsvRequest
= false
Whether current request is for CSV export (.csv extension)
$pluginViewCells
protected
array<string|int, mixed>
$pluginViewCells
= []
View cells from plugins for current request
Methods
beforeFilter()
Before filter - runs before each action.
public
beforeFilter(EventInterface $event) : Response|null
Parameters
- $event : EventInterface
-
Event
Return values
Response|nullinitialize()
Initialization hook.
public
initialize() : void
isCsvRequest()
Check if current request is for CSV export.
public
isCsvRequest() : bool
Return values
boolme()
Get current service principal details.
public
me() : void
switchView()
Switch between mobile and desktop view modes.
public
switchView() : Response
Stores preference in session and redirects to appropriate interface. Mobile redirects to viewMobileCard, desktop to profile.
Return values
Response —Redirect response
apiError()
Standard error response envelope.
protected
apiError(string $code, string $message[, array<string|int, mixed> $details = [] ][, int $statusCode = 400 ]) : void
Parameters
- $code : string
-
Error code
- $message : string
-
Error message
- $details : array<string|int, mixed> = []
-
Additional error details
- $statusCode : int = 400
-
HTTP status code
apiSuccess()
Standard success response envelope.
protected
apiSuccess(mixed $data[, array<string|int, mixed> $meta = [] ]) : void
Parameters
- $data : mixed
-
Response data
- $meta : array<string|int, mixed> = []
-
Optional metadata
authorizeCurrentUrl()
Authorize the current URL/action via Authorization component.
protected
authorizeCurrentUrl() : void
Tags
getPaginationMeta()
Build pagination metadata.
protected
getPaginationMeta() : array<string|int, mixed>
Return values
array<string|int, mixed>getServicePrincipal()
Get the authenticated service principal.
protected
getServicePrincipal() : ServicePrincipal
Tags
Return values
ServicePrincipalisServicePrincipal()
Check if current identity is a service principal.
protected
isServicePrincipal() : bool
Return values
boolorganizeViewCells()
Organize view cells by type and display order.
protected
organizeViewCells(array<string|int, mixed> $viewCells) : array<string|int, mixed>
Unused - view cells organized in ViewCellRegistry
Parameters
- $viewCells : array<string|int, mixed>
-
Flat array of view cell configurations
Return values
array<string|int, mixed> —Organized array grouped by type and sorted by order