@@ -23,6 +23,30 @@ with the |charts-short| Embedding SDK.
23
23
24
24
- :ref:`embedding-charts`
25
25
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
+
26
50
.. _specify-filter-fields:
27
51
28
52
Specify Filterable Fields
@@ -99,11 +123,12 @@ Use the ``filter`` query parameter to only display data that matches a
99
123
specified :abbr:`MQL (MongoDB Query Language)` filter in your
100
124
chart embedded in an iframe.
101
125
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
104
129
behavior differs with each authentication setting:
105
130
106
- - With Unauthenticated charts, the chart
131
+ - With unauthenticated charts, the chart
107
132
:ref:`Author <dashboard-roles>` specifies the fields that can be
108
133
included in filters set by the embedding application code or added by
109
134
chart viewers. To learn how to specify filterable fields, see
@@ -118,7 +143,8 @@ Filter Syntax
118
143
~~~~~~~~~~~~~
119
144
120
145
Select 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:
122
148
123
149
.. tabs::
124
150
0 commit comments