Forum Discussion

fc's avatar
fc
New Contributor III
2 years ago

Lock dashboard to other users

Hi all,

I'm developing a dashboard that will likely be used by 10 different people. I'd like to lock the access to other users if one user has the dashboard already open (and maybe until he/she clicks on a button to unlock it?)


Does anyone have a reliable approach to do this?

Thanks in advance!

  • JackLacava's avatar
    JackLacava
    2 years ago

    I suspect that this will give issues, as security rights are refreshed fairly rarely (i.e. at login).

    I more classic approach would be:

    1. have a custom database table with only a couple of fields (e.g. if the page is locked, who locked it, when it was locked)
    2. when a user opens it, in the page-load business rule, retrieve the relevant fields.
    3. If it's not locked, or it was locked a very long time ago (e.g. more than 2 hours), then update the fields and let the user in; otherwise, bail with an error message.

    As you mention, unlocking is an issue. I think there is a "page unload" event somewhere, but can't look it up right now; but keeping track of the last-locked time, you can basically use it with session-expiration strategies that will unlock it no matter what.

  • NicolasArgente's avatar
    NicolasArgente
    Valued Contributor

    Hey fc!
    I have never done that and never heard of a functionality to do that, as it is meant for group work, right?
    If you need to take that road, my thinking could be to create a specific group security group for this dashboard.
    You would have the starting dashboard page to "activate" the dashboard. On the back, a BR would add the username to this security group and check that there is only one user in this security group. If more then one, it drops a message saying that the other person is already using it... Now the limitation is that if the user does not "unlock" the dashboard after use, then it will always be blocked. You should maybe make this automatic too.
    As you see it is not straighforward, but possible.

    • JackLacava's avatar
      JackLacava
      Honored Contributor

      I suspect that this will give issues, as security rights are refreshed fairly rarely (i.e. at login).

      I more classic approach would be:

      1. have a custom database table with only a couple of fields (e.g. if the page is locked, who locked it, when it was locked)
      2. when a user opens it, in the page-load business rule, retrieve the relevant fields.
      3. If it's not locked, or it was locked a very long time ago (e.g. more than 2 hours), then update the fields and let the user in; otherwise, bail with an error message.

      As you mention, unlocking is an issue. I think there is a "page unload" event somewhere, but can't look it up right now; but keeping track of the last-locked time, you can basically use it with session-expiration strategies that will unlock it no matter what.

  • fc's avatar
    fc
    New Contributor III

    thank you both, I indeed followed Jack's suggestion to use a custom table to store the information of each user and lock them out in case another user is currently using the dashboard. It works!