Add support for configuring provisioning support for entitlements #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Introduces provisioning support. This is accomplished by adding a provisioning configuration per entitlement.
Example configuration:
In this configuration you can define a set of variables that can be CEL expressions. You can then reference these variables by placing
?<variable_name>within the query. During query execution, the expressions will be evaluated and added to the query. The CEL environment for these provisioning queries include:principal.ID,principal.Type,resource.ID,resource.Typeandentitlement.ID.The goal with variables is to allow transformations during sync to be 'reversed' during provisioning. A concrete example of this is in wordpress, the value that needs to be added to grant a role must be a PHP serialized array, but during sync we deserialize the PHP array to get the actual role name to use as the resource ID. In our example above we are able to transform the resource.ID into the array that needs to be written to the database.
For both grant and revoke you can specify a list of queries to run in order. These queries are run in a transaction, and if any fails we roll the transaction back. We need this functionality to support more complex provisioning operations(e.g. multiple tables need to be updated) or in the case of wordpress where the table isn't setup to support Upserting. Since a user may only have 1 role, we must first delete the original role, and then create a new one.