Stefan
Stefan

Reputation: 19

User impersonation

I need some advice/hints with something I've never done before. As a support user, I need to impersonate a logged in user and block the interface of that user while the support user is doing maintenance tasks( having the same experience as that logged in user).

The front-end of the app is written in Angular 2 and is getting data from a Drupal based back-end.

The problem is that I want to use web sockets to send to the logged in user, live information and how do I block his interface?

Edit: So I have new requirements. So the support user can impersonate a user, but if a user is logged, the support needs to send live notifications to the other user and then block his interface(normal user). Can i do that just with drupal + angular or do I need node js as the middle sv.

Upvotes: 1

Views: 1072

Answers (1)

Marc Hägele
Marc Hägele

Reputation: 342

I would do the following: Extend the User Table by 2 Columns [ImpersonatedAsUserKey], [UiBlocked]

Some Grid where the Supporter can search for the ActiveUsers with a button to impersonate. When the supporter clicks on "Impersonate"

Update the database Row of support User to [ImpersonatedAsUserKey] = "selectedUserKey"

Update the database Row of affected user to [UiBlocked] = true

Send a SocketMessage to the Affected User to change the UI with a modal dialog advising him that he is receiving Support by a Support User.

Then on the instance of the Supporter re-charge the web like the affectedUser by the [ImpersonatedAsUserKey]

A thing to have in mind: if the user makes a refresh of the page take in mind to check for the UiBlocked value in the database to show the drop modal if there is a value.

When you finish with "impersonation" then reset the database values to default and send a socket message to the User to hide the drop modal.

and reload the Support UI to get his default UI.

Best regards!

Upvotes: 1

Related Questions