cancel
Showing results for 
Search instead for 
Did you mean: 

Hide Widget Using Web Access Token

zach_myt
10 - ETL
10 - ETL

We have an embedded dashboard that utilizes web access token for filtering on different organizations. We have a widget that only needs to be displayed to certain organizations. Does anyone know if we can filter individual widgets using the web access tokens?

5 REPLIES 5

rapidbisupport
10 - ETL
10 - ETL

Hey @zach_myt ,

If you have user attached to the sub property in the WAT payload, I think you can see the user using 'prism.user'. You then should be able to show / hide the widget based on the userid related to the WAT:

const hideWidgets = ['659f84e9800ddf004150f24a', '659f84e9800ddf004150f24a']
const usersToHide = ['userid1', 'userid2']

dashboard.on('domready', () => {
	if (!usersToHide.includes(prism.user._id)) { return }
	prism.$ngscope.$broadcast('tab-change', {
		show: [],
		hide: hideWidgets || [],
		tabsConfig: 'multiply',
		renderWidgets: false
	})
})

This dashboard script requires that Tabber plugin be enabled, and pretty much works by telling Sisense that you're on a tab that doesn't include the widgets in the hideWidgets array.

The condition may need to change based on what the WAT exposes to Sisense, so if this doesn't work, you might see something in the prism.user object that may identify the specific WAT - let me know if this is the case - i'd be interested to hear.

Happy to take a look with you over Sisense Services | Free 30-Minute Sisense Consultation (rapidbi.com.au) and provide advice over a screenshare if you need to get more specific than the code above.

Let me know how you go?

zach_myt
10 - ETL
10 - ETL

All users are logging into our application which has no relation to Sisense user logins. Siesnse dashboards are currently embedded via an iFrame in our application. Our application has thousands of users but our Sisense instance only has around 20. The WAT does filtering for Organizations only currently since those organizations are listed in Sisense. I would like logic to be:

If WAT = 123 for Organization = 123 then hide widget_id = abc

Does that make sense?

hi @zach_myt ,

We're on the same page. WAT is not necessarily linked to a user (in most cases not). I've shared a link below on linking WAT to a user for the purpose of using connection parameters as a work around.

Using Web Access Tokens (sisense.com)

In this documentation, you can see that they've link a user to the WAT which I assume you can then act on from a dashboard level.

My approach to your problem would be to link a group to each WAT and then check to see if this group is accessible from the dashboard script in the prism.user (it's usually prism.user.groups.groupNames or something like this...) object - if it is, you can use this conditionally to hide specific widgets (as per script provided).

If it doesn't - then you might consider parsing the iFrame url for the token before using it dashboard side, but this feels more like a hack. I think you should look for other solutions before perusing this one.

Although we have implemented WAT for customers in the past, we don't actively maintain a test environment leveraging WAT. I suspect that there are additional properties accessible to the dashboard script where WAT is employed, but I don't have any way to explore and confirm this.

If you'd like to explore together, then Sisense Services | Free 30-Minute Sisense Consultation (rapidbi.com.au) could be a good way forward (if you use the link and provide some details, we can schedule a 30-minute no-obligation call where we try to solve your problem). I'd be happy to take a look with you and try find a better / less hack property directly related to the WAT that we can use dashboard script side.

Thanks,

Daniel

RAPID BI

[email protected]

RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons

zach_myt
10 - ETL
10 - ETL

I don't have access to the WAT section of the application, my dev team does but I had a thought before getting them involved. Would it be possible to use the dashboard script to do this without getting the WAT or do I absolutely need the WAT to hide the widget?

I ask because prism.user._id looks to be the same value for all sites I sign into. I should note we only have 1 WAT for all organizations, could the dev team be using the WAT differently on the back end to achieve the filtering?

zach_myt
10 - ETL
10 - ETL

I opened a ticket with support and they said there is no claim on the WAT that will currently let you hide one widget so there will have to be some customization here. I was unable to identify anything unique to organizations in the prism object so far. 

@rapidbisupport since we are only using 1 WAT for all organization I do not think your approach will work, although I do see the groups the dashboard is shared with like you mentioned in prism.user.groupsNames.name