Provisionable Models are core Registry model that support exporting their records via the Registry PE Provisioning interface. Certain requirements must be met for a Model to be provisionable.
Primary vs Secondary Objects
Both Primary Objects (eg: People) and Secondary Objects (eg: Names) can be provisionable, but they are handled slightly differently. In short, Primary Objects are what Provisioner Plugins expect to work with, Secondary Objects trigger provisioning of their associated Primary Object.
Note that it is possible to provision Artifacts and Configuration objects as well, they should be treated as Primary Objects as described in this document.
Provisionable Model Requirements
For all Provisionable Models:
- The Provisionable Model (eg:
NamesTable
) shoulduse \App\Lib\Traits\ProvisionableTrait
(be careful not to typo ProvisionerTrait).
For Primary Objects only:
- The Provisionable Model should update
setPermissions
to allowplatformAdmin
andcoAdmin
permissions for theprovision
action in theentity
context. - The Provisionable Model should implement a
marshalProvisioningData
function that accepts the ID of the entity to be provisioned, and returns an array with the following keys:data
: The current data to be provisioned, in the format returned byTable::get()
eligibility
: The provisioning eligibility of the entity, as described here.
When Provisioning Happens
Registry PE uses Intent Driven Provisioning, which means provisioning is explicitly called when the application determines it is an appropriate time to do so. (This differs from v4, which uses Side Effect Driven Provisioning, triggering provisioning when a change is made to any provisionable model.) This includes:
- When changes are made to a Provisionable Object, either via the UI (StandardController) or the API (ApiV2Controller).
- At the appropriate point in an Enrollment Flow or Pipeline (not yet implemented, CFM-31 and CFM-33).
Example
// src/ModelTable/WidgetsTable.php use \App\Lib\Enum\ProvisioningEligibilityEnum; class WidgetsTable extends Table { use \App\Lib\Traits\ProvisionableTrait; ... public function initialize(array $config): void { ... $this->setPermissions([ 'entity' => [ 'provision' => ['platformAdmin', 'coAdmin'], ... ], ... ]); public function marshalProvisioningData(int $id): array { $entity = $this->get($id, [ // We need archives for handling deleted records 'archived' => 'true', 'contain' => [ 'SubWidgets' ] ]); return [ 'data' = $entity, 'eligibility = ($entity->isActive() ? ProvisioningEligibilityEnum::Eligible : ProvisioningEligibilityEnum::Ineligible) ]; } } }