@@ -23,6 +23,30 @@ with the |charts-short| Embedding SDK.
2323
2424 - :ref:`embedding-charts`
2525
26+ .. _inject-filter-per-user:
27+
28+ Inject User-Specific Filters
29+ ----------------------------
30+
31+ When you embed a chart requiring :guilabel:`Authenticated` access, you
32+ can use the :guilabel:`Inject Filter Per User` setting to inject a
33+ MongoDB filter document specific to each user who views
34+ the chart. The function has access to your Embedding Authentication
35+ Provider's token via ``context.token``, and can filter the chart data
36+ based on the token.
37+
38+ This filter ensures that viewers of an embedded chart see only their
39+ own data, which is useful when embedding charts with potentially
40+ sensitive information.
41+
42+ To inject a filter specific to each user, in the
43+ :guilabel:`Authenticated` tab of the the :guilabel:`Embed Chart`
44+ dialog, set the :guilabel:`Inject Filter Per User`
45+ setting to :guilabel:`On`. Specify a function and click
46+ :guilabel:`Save`.
47+
48+ .. include:: /includes/example-user-filter-function.rst
49+
2650.. _specify-filter-fields:
2751
2852Specify Filterable Fields
@@ -99,11 +123,12 @@ Use the ``filter`` query parameter to only display data that matches a
99123specified :abbr:`MQL (MongoDB Query Language)` filter in your
100124chart embedded in an iframe.
101125
102- You can use the ``filter`` query parameter on both Unauthenticated
103- charts and charts which require a Verified Signature. The filtering
126+ You can use the ``filter`` query parameter on both
127+ :guilabel:`Unauthenticated`
128+ and :guilabel:`Verified Signature` charts. The filtering
104129behavior differs with each authentication setting:
105130
106- - With Unauthenticated charts, the chart
131+ - With unauthenticated charts, the chart
107132 :ref:`Author <dashboard-roles>` specifies the fields that can be
108133 included in filters set by the embedding application code or added by
109134 chart viewers. To learn how to specify filterable fields, see
@@ -118,7 +143,8 @@ Filter Syntax
118143~~~~~~~~~~~~~
119144
120145Select the appropriate tab to see an example of how to filter data in
121- an Unauthenticated chart and a Verified Signature chart:
146+ an :guilabel:`Unauthenticated` chart and a
147+ :guilabel:`Verified Signature` chart:
122148
123149.. tabs::
124150
0 commit comments