coherence icon indicating copy to clipboard operation
coherence copied to clipboard

Masquerade

Open carterbryden opened this issue 8 years ago • 3 comments

How would you recommend going about creating a masquerade feature? Is this something you'd be interested in seeing as a PR?

carterbryden avatar Oct 04 '17 07:10 carterbryden

@carterbryden I might take a crack at this myself. As much as I don’t think I like the feature, it’s very useful for some people on my team when customers are having trouble.

seanwash avatar Oct 27 '17 00:10 seanwash

@carterbryden I have this working for my needs currently, although it's a pretty crude, non reusable solution. Im using the following code in a protected admin controller.

# ...current_user permissions check not included

# Log the current user out
conn =
  Coherence.Config.auth_module
  |> apply(Coherence.Config.delete_login(), [conn, [id_key: Coherence.Config.schema_key()]])

# Login the new specified user
Coherence.Config.auth_module
|> apply(Coherence.Config.create_login(), [conn, user, [id_key: Coherence.Config.schema_key()]])
|> redirect(to: page_path(conn, :index))

seanwash avatar Oct 27 '17 16:10 seanwash

I have this feature on a private branch. I'll see if I can get some time to merge it. BTW, it only works in dev builds so there shouldn't be any security concerns for production deployment.

smpallen99 avatar Nov 05 '17 16:11 smpallen99