ServicePrincipalsController
extends AppController
in package
ServicePrincipals Controller - Admin Management
Provides web interface for managing service principals, their roles, and tokens.
Table of Contents
Constants
- VIEW_DATA_EVENT = 'KMP.plugins.callForViewData'
- VIEW_PLUGIN_EVENT = 'KMP.plugins.callForViewCells'
Properties
- $ServicePrincipals : ServicePrincipalsTable
- $isCsvRequest : bool
- $pluginViewCells : array<string|int, mixed>
Methods
- add() : Response|null
- Add method - create new service principal.
- addRole() : Response|null
- Add role to service principal.
- beforeFilter() : Response|null|void
- Pre-action filter for application-wide processing.
- credentials() : Response|null
- Credentials method - display newly created credentials (one-time).
- delete() : Response
- Delete method - remove service principal.
- edit() : Response|null
- Edit method - modify service principal details.
- index() : void
- Index method - list all service principals.
- initialize() : void
- Initialize controller and configure authorization.
- isCsvRequest() : bool
- Check if current request is for CSV export.
- regenerateToken() : Response|null
- Regenerate token - create new bearer token.
- revokeRole() : Response
- Revoke role from service principal.
- revokeToken() : Response
- Revoke token - invalidate a bearer token.
- switchView() : Response
- Switch between mobile and desktop view modes.
- toggleActive() : Response
- Toggle active status.
- view() : void
- View method - show service principal details.
- authorizeCurrentUrl() : void
- Authorize the current URL/action via Authorization component.
- 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
$ServicePrincipals
public
ServicePrincipalsTable
$ServicePrincipals
$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
add()
Add method - create new service principal.
public
add() : Response|null
Return values
Response|nulladdRole()
Add role to service principal.
public
addRole(int $id) : Response|null
Parameters
- $id : int
-
Service principal ID
Return values
Response|nullbeforeFilter()
Pre-action filter for application-wide processing.
public
beforeFilter(EventInterface $event) : Response|null|void
Handles: CSV detection, plugin validation, navigation history, view cell loading, and Turbo Frame detection.
Parameters
- $event : EventInterface
-
The beforeFilter event
Return values
Response|null|voidcredentials()
Credentials method - display newly created credentials (one-time).
public
credentials(int $id) : Response|null
Parameters
- $id : int
-
Service principal ID
Return values
Response|nulldelete()
Delete method - remove service principal.
public
delete(int $id) : Response
Parameters
- $id : int
-
Service principal ID
Return values
Responseedit()
Edit method - modify service principal details.
public
edit(int $id) : Response|null
Parameters
- $id : int
-
Service principal ID
Return values
Response|nullindex()
Index method - list all service principals.
public
index() : void
initialize()
Initialize controller and configure authorization.
public
initialize() : void
isCsvRequest()
Check if current request is for CSV export.
public
isCsvRequest() : bool
Return values
boolregenerateToken()
Regenerate token - create new bearer token.
public
regenerateToken(int $id) : Response|null
Parameters
- $id : int
-
Service principal ID
Return values
Response|nullrevokeRole()
Revoke role from service principal.
public
revokeRole(int $id, int $roleId) : Response
Parameters
- $id : int
-
Service principal ID
- $roleId : int
-
ServicePrincipalRole ID
Return values
ResponserevokeToken()
Revoke token - invalidate a bearer token.
public
revokeToken(int $id, int $tokenId) : Response
Parameters
- $id : int
-
Service principal ID
- $tokenId : int
-
Token ID
Return values
ResponseswitchView()
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
toggleActive()
Toggle active status.
public
toggleActive(int $id) : Response
Parameters
- $id : int
-
Service principal ID
Return values
Responseview()
View method - show service principal details.
public
view(int $id) : void
Parameters
- $id : int
-
Service principal ID
authorizeCurrentUrl()
Authorize the current URL/action via Authorization component.
protected
authorizeCurrentUrl() : void
Tags
organizeViewCells()
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