Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Impersonate integration with devise #2444

Closed
edimossilva opened this issue Oct 9, 2023 · 2 comments
Closed

Add Impersonate integration with devise #2444

edimossilva opened this issue Oct 9, 2023 · 2 comments

Comments

@edimossilva
Copy link
Contributor

  • What would you like to be able to do? Can you provide some examples?
    • At Show User Page We could add a button Impersonate at the UI. When the button is clicked The current user would be logged out and a new login would be done with the desired user.
  • How could we go about implementing that?
    • Add a method Impersonation_enabled? in the User dashboard controller with a default return to false, it can be overridden to true
  • Can you think of other approaches to the problem?
    • Instead of having a method on the controller we can use a configuration key.
    • I am not sure about the approach but I would love to work on it, if there is interest on the feature I can investigate and plan something better.
@nickcharlton
Copy link
Member

I think this is a good idea, but I wonder if it should be in a plugin of some kind, rather than the core of Administrate. What do you think?

I think if we took that approach, we might need to work out how to provide the relevant sort of plugin hooks to make it possible.

@pablobm
Copy link
Collaborator

pablobm commented Feb 23, 2024

I'm not sure about this one. I think that Administrate should be independent from authentication, and users should implement their own. If anything, we should make sure that this is easy to do. I haven't tried integrating with something like Devise or Clearance, so if Administrate doesn't play well with them, that's something we should improve. Then you can use these (or anything else) to implement an impersonation mechanism.

Incidentally, the example app implements an impersonation feature in the "Customers" dashboard. See the action "Become":

customer-actions

This new action is handled in CustomersController: https://github.com/thoughtbot/administrate/blob/main/spec/example_app/app/controllers/admin/customers_controller.rb Would something like this work for you?

I'm going to close, but please do let us know if there's something that doesn't quite work. I'll be happy to reopen!

@pablobm pablobm closed this as completed Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants