Filter by user
If your project uses Rill's security policies to filter dashboard access, you need to pass information about the end user in the iframe request. The simplest way to do this is using the user_email attribute.
In this example, the metrics view has a security policy that limits access to users with a valid email domain, then applies a row filter to only show data for the user's email domain. Switch between the users below to change the value passed in the iframe request, the dashboard will reflect the matching domain.
Metrics view security policy
security:
# Show the dashboard only to users with a valid email domain.
access: "{{ if .user.domain }} true {{ else }} false {{ end }}"
# Filter data by the requesting user's email domain.
row_filter: app_site_domain = '{{ .user.domain }}'Source: embedding/rill-project/metrics/auctions_security_domain.yaml
Select user
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_domain",
"user_email": "user1@fubo.tv"
}Source: embedding/web/src/app/security/filter-by-user/page.tsx
Loading...