> For the complete documentation index, see [llms.txt](https://docs.planetcrust.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.planetcrust.com/platform-administration-console/references/contextual-role-evaluation.md).

# Contextual Role Evaluation

<p align="center"><a class="button primary" data-icon="square-caret-right">Try @Human</a><a class="button primary" data-icon="check">Buy @Human Subscription</a><a class="button primary" data-icon="comments">Join @Human Community</a></p>

Refer to Expressions[^1] for details on writing context role expressions.

If the expression returns `true`, the contextual role is applied.

| userID | The ID of the current user. |
| ------ | --------------------------- |

### Records

| resource.ID          | The ID of the resource.                                                                                                     |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| resource.recordID    | The ID of the resource; same as resource.ID.                                                                                |
| resource.moduleID    | The ID of the related module.                                                                                               |
| resource.labels      | The key-value pair of labels associated with this resource.                                                                 |
| resource.namespaceID | The ID of the related namespace.                                                                                            |
| resource.ownedBy     | The userID of the resource owner.                                                                                           |
| resource.createdAt   | The timestamp of when the resource was created.                                                                             |
| resource.createdBy   | The userID of the user that created the resource.                                                                           |
| resource.updatedAt   | The timestamp of when the resource was last updated. The parameter is not defined if the resource has not yet been updated. |
| resource.updatedBy   | The userID of the user that last updated the resource. The parameter will be `0` if the resource has not yet been updated.  |
| resource.deletedAt   | The timestamp of when the resource was deleted. The parameter is not defined if the resource has not been deleted.          |
| resource.deleteBy    | The userID of the user that deleted the resource. The parameter will be `0` if the resource has not been updated.           |
| resource.values      | A set of key-value pairs for the record values defined by the module fields.                                                |

{% hint style="info" %}
If a module field is a multi-value, the corresponding key-value entry will be an array.
{% endhint %}

### Workflows <a href="#workflows" id="workflows"></a>

| resource.ID         | The ID of the resource.                                                                                                     |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| resource.workflowID | The ID of the resource; same as resource.ID.                                                                                |
| resource.labels     | The key-value pair of labels associated with this resource.                                                                 |
| resource.ownedBy    | The userID of the resource owner.                                                                                           |
| resource.createdAt  | The timestamp of when the resource was created.                                                                             |
| resource.createdBy  | The userID of the user that created the resource.                                                                           |
| resource.updatedAt  | The timestamp of when the resource was last updated. The parameter is not defined if the resource has not yet been updated. |
| resource.updatedBy  | The userID of the user that last updated the resource. The parameter will be `0` if the resource has not yet been updated.  |
| resource.deletedAt  | The timestamp of when the resource was deleted. The parameter is not defined if the resource has not been deleted.          |
| resource.deletedBy  | The userID of the user that deleted the resource. The parameter will be `0` if the resource has not been updated.           |

### Auth clients <a href="#auth_clients" id="auth_clients"></a>

| resource.ID          | The ID of the resource.                                                                                                     |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| resource.labels      | The key-value pair of labels associated with this resource.                                                                 |
| resource.scope       | The scope defined by the auth client.                                                                                       |
| resource.validGrant  | The grant that is supported by the auth client.                                                                             |
| resource.redirectURI | The redirect URI for the auth client.                                                                                       |
| resource.trusted     | The trust setting of the auth client.                                                                                       |
| resource.enabled     | The enabled setting for the auth client.                                                                                    |
| resource.validFrom   | The timestamp denoting when the auth client is valid from.                                                                  |
| resource.expiresAt   | The timestamp denoting when the auth client is no longer valid.                                                             |
| resource.ownedBy     | The userID of the resource owner.                                                                                           |
| resource.createdAt   | The timestamp of when the resource was created.                                                                             |
| resource.createdBy   | The userID of the user that created the resource.                                                                           |
| resource.updatedAt   | The timestamp of when the resource was last updated. The parameter is not defined if the resource has not yet been updated. |
| resource.updatedBy   | The userID of the user that last updated the resource. The parameter will be `0` if the resource has not yet been updated.  |
| resource.deletedAt   | The timestamp of when the resource was deleted. The parameter is not defined if the resource has not been deleted.          |
| resource.deletedBy   | The userID of the user that deleted the resource. The parameter will be `0` if the resource has not been updated.           |

[^1]: Add link


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.planetcrust.com/platform-administration-console/references/contextual-role-evaluation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
