Proof of concept for collective.impersonate like behavior in volto

Hi,

i recently stumbled upon collective.impersonate while searching for this exact solution for a problem we are facing.

We are currently on ClassicUI but plan to switch to volto in the near future.

Sadly collective.impersonate only works in ClassicUI.

So I sat down and worked out a little proof of concept for the impersonate functionality with volto.

I’m not very familiar with volto development in particular, but done a good amount of redux and react. So I would like to gather some feedback, whether the idea is viable. Maybe I’m missing something totally fundamental in the user session process.

The idea is the following:

Plone Backend:

  • Plone Backend Rest Endpoint /impersonate, which generates a new jwt and session for the given user id

Volto:

  • api action to call the /impersonate endpoint
  • a middleware which looks out for the IMPERSONATE_SUCCESS action
    • it updates the auth_token cookie with the new jwt token
    • it dispatches a LOGIN_SUCCESS action to update the token in the userSession state

I fork of collective.impersonate and added the rest action: Nimo-19 collective.impersonate feature/add_impersonate_rest_service

and I created the volto addon: Nimo-19 volto-impersonate

When this works and some people are interested in using this, I would like to polish and publish it someday.

1 Like