diff --git a/website/docs/expressions/_user.md b/website/docs/expressions/_user.md new file mode 100644 index 000000000..aab77387f --- /dev/null +++ b/website/docs/expressions/_user.md @@ -0,0 +1,9 @@ +- `user`: The current user. This may be `None` if there is no contextual user. See ([User](../user-group/user.md#object-attributes)) + +Example: + +```python +return { + "custom_attribute": request.user.attributes.get("custom_attribute", "default"), +} +``` \ No newline at end of file diff --git a/website/docs/property-mappings/expression.mdx b/website/docs/property-mappings/expression.mdx index 0d69974b1..c8c0e36bb 100644 --- a/website/docs/property-mappings/expression.mdx +++ b/website/docs/property-mappings/expression.mdx @@ -17,6 +17,9 @@ import Objects from '../expressions/_objects.md' -- `user`: The current user. This may be `None` if there is no contextual user. See ([User](../user-group/user.md#object-attributes)) +import User from '../expressions/_user.md' + + + - `request`: The current request. This may be `None` if there is no contextual request. See ([Django documentation](https://docs.djangoproject.com/en/3.0/ref/request-response/#httprequest-objects)) - Other arbitrary arguments given by the provider, this is documented on the Provider/Source.