29
Views
4
Comments
Solved
User with multiple company profiles
Application Type
Reactive
Service Studio Version
11.54.27 (Build 62831)
Platform Version
11.23.1 (Build 40847)

Hi Guys,

I'm working on a Reactive application in which the logged in user has several access profiles, to see different companies data

Example:
User 000001 - Profile_01 - Company 01
User 000001 - Profile_02 - Company 02

The user is logged in, opened two browser tabs, both with Profile_01 - Company 01.

If he switches to Profile_02 in the first tab, then the system will reload the data for Company 02. But how do I update the information in tab 02 that he opened with Profile_01 and the data from Company 01 still appears?

For me, the best scenario would be to close the connection from the other tabs, but if that's not possible, I would at least want to reload the data, or force a new login.

Could anyone give me any tips on the best way to solve this problem?

Solution

Hi,

if it is only about different tabs on the same browser (so on same device, all within chrome browser, for example), you could take a look at broadcast channel api.

You can easily do it yourself with some lines of javascript.  

I see there is a forge component also, have never checked it out, so maybe go and explore that.

You can basically broadcast a message somewhere in the login and logout flows, and add a listener somewhere in the layout, to make sure all screens do it.  

In the listener, you could push an event out from the layout webblock, and let all screens handle it by refreshing themselves, or to avoid all screens needing logic for this, just limit everything to the layout by maybe reloading the default or current screen or something like that.

Dorine

Hi Dorine,

I really liked your suggestion, and I'm going to do some tests. 

Thank you very much!

JM

I suggest creating a new profile called 'Profile_03' that combines the permissions of the existing profiles (Profile_01 and Profile_02). This new profile will simplify the control of access to companies.

Hi Adão,

Unfortunately I can't do this, because in each company the user has different permissions, so I can't merge them. :/

Solution

Hi,

if it is only about different tabs on the same browser (so on same device, all within chrome browser, for example), you could take a look at broadcast channel api.

You can easily do it yourself with some lines of javascript.  

I see there is a forge component also, have never checked it out, so maybe go and explore that.

You can basically broadcast a message somewhere in the login and logout flows, and add a listener somewhere in the layout, to make sure all screens do it.  

In the listener, you could push an event out from the layout webblock, and let all screens handle it by refreshing themselves, or to avoid all screens needing logic for this, just limit everything to the layout by maybe reloading the default or current screen or something like that.

Dorine

Hi Dorine,

I really liked your suggestion, and I'm going to do some tests. 

Thank you very much!

JM

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.