Hey team, I have a question about locked filters. ...
# gd-beginners
s
Hey team, I have a question about locked filters. Hopefully if someone is able to help or suggest a few alternatives it would be great 🙂. My problem: I need to embed a Dashboard in my platform and set a locked or hidden filter to match a company Id. I'm using the JWT approach to create a session with Good Data using the
BackendProvider
React component. Is it possible to have the Dashboard Filter set the value based on a value set in the JWT? If not, what would be a better approach? Thank you 🙏
j
Hi Stefan, how is this intended to be used exactly? Is this to set filters based on the user who is logging in? If that is the case, User Data Filters are the most secure way to ensure users don't see any data they are not supposed to. If this doesn't fit your use case, could you expand a bit further as to how you need the filters to work based on the user?
s
This may work but that means for each user I need to create a relationship with the company Id that is applied on the filter
Is this correct?
j
That's correct. You could also use Workspace Data Filters but I'm not sure if this fits your use case completely
s
Is it possible for the value of the data filter be set by a value in the JWT?
j
No, this is not currently possible
s
I have another requirement that a user has multiple companies
Do I need to update that filter every time a load the dashboard
Thank you for your help @Joseph Heun this helps me a lot 🙂
j
No problem! You wouldn't need to update the filter every time the dashboard is loaded. Once you set the UDF for a user it will remain applied until it has been updated. You can set a maql expression to limit specifically what the user sees.
s
But how would I change from filtering from company A to company B
I'll explain in a bit more details our use case. We have one to many relationship between user and company. A user can have multiple companies. When we load the dashboard we want to only load information for one company, and not all of them.
j
The user would still need the ability to chose the value in the dashboard filter for the company they need to see. If the user has the UDF applied, then when selecting a value in the dropdown of the company filter, they would only see the companies that they have access to.
s
Unfortunately, in our case we don't want the user to change the company in that filter. That filter will be locked and should be set prior. If I change it with the API, do you think it will work?
j
yes, that is a possibility