[Local Storage] ClearAllLocalStorage - clears roles?

Forge Component
(8)
Published on 15 Jun by Paulo Cação
8 votes
Published on 15 Jun by Paulo Cação

Hi -

Doing some tests with this, when we call "ClearAllLocalStorage", the user remains logged in (I think) but they have no roles anymore, and they need to re-login to get their roles back.

Any idea what could be happening here? I tested in a fresh module.

Thanks!

J.Ja

Hi Justin,

When we use ClearAllLocalStorage we will clear your local variables, this is not related with session:

Regards

Paulo Cação wrote:

Hi Justin,

When we use ClearAllLocalStorage we will clear your local variables, this is not related with session:

Regards


Paulo -

I have confirmed beyond any doubt that this caused the problem (made a test Module in a brand new application). Could the issue be that it is a Reactive Web app? Or maybe a platform update made this happen? We are on the latest, 11.8.

J.Ja

Hi Justin,

I will try check this behavior asap. Maybe the rules are saved in local storage var (or something like that), and when we clear the local storage vars, the user roles are cleared also.


Regards

Hi,

OutSystems stores various data in different Local Storage keys for PWA, including User Role Information in the data attribute of $OS_Users$RolesInfo key.

I would say that the component should not remove any $OS_ variable from local storage.

Regards,

Daniel

Hi Daniël, 

This component uses the localStorage API available in each browser. The ClearAllLocalStorage action calls the localStorage.clear() method and so it clears all keys in the storage.

I guess that what we can do is before clearing the storage make a copy of all $OS_ variables and then set them again... That or just remove the ClearAllLocalStorage action and allow only to remove one key at a time. 

Thanks!

Hi,

I have updated a new version, now you can remove all variable except the OS vars. Update the plugin and enjoy it.

Best Regards,

Paulo

Paulo Cação wrote:

Hi,

I have updated a new version, now you can remove all variable except the OS vars. Update the plugin and enjoy it.

Best Regards,

Paulo

Thanks Paulo!

J.Ja