Filter by custom attributes
If the built-in user attributes based on user_email aren't enough, you can instead pass arbitrary custom attributes in the iframe request using the attributes property. Each key becomes a user attribute that the metrics view's security policy can reference.
In this example, the metrics view has a security policy that applies a row filter based on custom app_site_name and pub_name user attributes. Switch between the presets below to change the values passed in the iframe request.
Metrics view security policy
security:
# Show the dashboard only to users with the "app_site_name" and "pub_name" custom attributes.
access: '{{ hasKey .user "app_site_name" }} AND {{ hasKey .user "pub_name" }}'
# Filter data by the user's custom attributes.
row_filter: >
app_site_name = '{{ .user.app_site_name }}'
AND pub_name = '{{ .user.pub_name }}'Source: embedding/rill-project/metrics/auctions_security_custom_attributes.yaml
Select attributes
Iframe request
POST https://api.rilldata.com/v1/orgs/demo/projects/rill-embedding/iframe
Authorization: Bearer <RILL_SERVICE_TOKEN>
Content-Type: application/json
{
"type": "explore",
"resource": "auctions_explore_security_custom_attributes",
"attributes": {
"app_site_name": "FuboTV",
"pub_name": "Taboola"
}
}Source: embedding/web/src/app/security/filter-by-custom-attributes/page.tsx
Loading...