Skip to content

RbacDefinitionConfigHandler

RbacDefinitionConfigHandler handles RBAC role and permission definition files.

Migrated to IArrayConfigHandler (phase 2). Canonical schema is a flat map, role name => entry, already exactly what execute() built inline: [‘role_name’ => [‘parent’ => ‘parent_role_name’|null, ‘permissions’ => [‘perm1’, ‘perm2’]]] Nested in XML become entries with ‘parent’ set; a PHP/YAML file writes that same flat map directly (there’s no XML-specific nesting concept left to represent once you’re at this shape).

class RbacDefinitionConfigHandler extends XmlConfigHandler implements IArrayConfigHandler, IPositionAwareConfigHandler, ISchemaAwareConfigHandler

ExtendsXmlConfigHandler
ImplementsIArrayConfigHandler, IPositionAwareConfigHandler, ISchemaAwareConfigHandler
Since1.0.0
SourceConfig/RbacDefinitionConfigHandler.php
ConstantValueDescription
XML_NAMESPACE'http://quiote.dev/quiote/config/parts/rbac_definitions/1.1'
MethodDescription
execute(XmlConfigDomDocument $document): mixedExecute this configuration handler.
[`executeArray(array<string, array{parent: ?string, permissions: array<int, mixed>}> $config, stringnull $sourceRef = null): mixed`](#executearray)
schema(): RuleReturns the structural rule for the RBAC definitions.
toCanonicalArray(XmlConfigDomDocument $document): array<string, array{parent: ?string, permissions: array<int, mixed>}>
toCanonicalArrayWithPositions(XmlConfigDomDocument $document, ElementPositionIndex $positions): array{data: array<string, array{parent: ?string, permissions: array<int, mixed>}>, positions: array<string, array{file: string, line: int}>}

public function execute(XmlConfigDomDocument $document): mixed

Execute this configuration handler.

The document to parse.

ParameterTypeDescription
$documentXmlConfigDomDocumentThe document to parse.

Returns mixed — The declaration to be cached.

ThrowsWhen
UnreadableExceptionIf a requested configuration file does not exist or is not readable.
ParseExceptionIf a requested configuration file is improperly formatted.

public function executeArray(array<string, array{parent: ?string, permissions: array<int, mixed>}> $config, string|null $sourceRef = null): mixed

Origin reference for the compiled cache file’s header comment (a file path for any format; XML’s is $document->documentURI).

ParameterTypeDescription
$configarray``<``string``, ``array{parent: ?string, permissions: array<int, mixed>}``>The canonical config array, matching the shape returned by toCanonicalArray().
$sourceRef`string““null`

Returns mixed — The declaration to be cached, exactly as IXmlConfigHandler::execute() returns.

public function schema(): Rule

Returns the structural rule for the RBAC definitions.

The canonical array is a flat map of role name to an entry holding the role’s optional parent and its list of permissions; the nesting XML allows is already flattened into parent references by this point.

Returns Rule

public function toCanonicalArray(XmlConfigDomDocument $document): array<string, array{parent: ?string, permissions: array<int, mixed>}>

ParameterTypeDescription
$documentXmlConfigDomDocument

Returns array``<``string``, ``array{parent: ?string, permissions: array<int, mixed>}``>

public function toCanonicalArrayWithPositions(XmlConfigDomDocument $document, ElementPositionIndex $positions): array{data: array<string, array{parent: ?string, permissions: array<int, mixed>}>, positions: array<string, array{file: string, line: int}>}

ParameterTypeDescription
$documentXmlConfigDomDocument
$positionsElementPositionIndex

Returns array{data: array<string, array{parent: ?string, permissions: array<int, mixed>}>, positions: array<string, array{file: string, line: int}>}

These come from an ancestor and are documented where they are declared.

MethodDeclared inDescription
appendParameter()ParameterHolderAppend a parameter.
appendParameterByRef()ParameterHolderAppend a parameter by reference.
clearParameters()ParameterHolderClear all parameters associated with this request.
getFlatParameterNames()ParameterHolderRetrieve an array of flattened parameter names.
getParameter()ParameterHolderRetrieve a parameter.
getParameterNames()ParameterHolderRetrieve an array of parameter names.
getParameters()ParameterHolderRetrieve an array of parameters.
hasParameter()ParameterHolderIndicates whether or not a parameter exists.
initialize()XmlConfigHandlerInitialize this ConfigHandler.
literalize()BaseConfigHandlerLiteralize a string value.
removeParameter()ParameterHolderRemove a parameter.
replaceConstants()BaseConfigHandlerReplace configuration directive identifiers in a string.
replacePath()BaseConfigHandlerReplace a relative filesystem path with an absolute one.
reset()ParameterHolderRemoves every parameter held, leaving the holder empty for reuse.
setParameter()ParameterHolderSet a parameter.
setParameterByRef()ParameterHolderSet a parameter by reference.
setParameters()ParameterHolderSet an array of parameters.
setParametersByRef()ParameterHolderSet an array of parameters by reference.