Skip to main content

Entitlement Read

Overview

Use these commands to intercept the entitlement-read command.

Input/OutputData Type
InputStdEntitlementReadInput
OutputStdEntitlementReadOutput

Example StdEntitlementReadInput

{
"identity": "john.doe",
"key": {
"simple": {
"id": "john.doe"
}
},
"type": "group"
}

Example StdEntitlementReadOutput

{
"identity": "john.doe",
"key": {
"simple": {
"id": "administrator"
}
},
"type": "group",
"attributes": {
"id": "administrator",
"name": "Administrator"
}
}

Implementation

Before entitlement-read command

Use this logic to implement the command:

    .beforeStdEntitlementRead(async (context: Context, input: StdEntitlementReadInput) => {
logger.info(`Running before entitlement read for account ${input.identity}`)
return input
})

The input object can be mutated and returned, but the same data type must still be returned.

After entitlement-read command

Use this logic to implement the command:

    .afterStdEntitlementRead(async (context: Context, output: StdEntitlementReadOutput) => {
logger.info(`Running after entitlement read for account ${output.identity}`)
return output
})

The output object can be mutated and returned, but the same data type must still be returned.