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

[4.x] Add ability to impersonate a user #8622

Merged
merged 13 commits into from Sep 19, 2023

Conversation

ryanmitchell
Copy link
Contributor

@ryanmitchell ryanmitchell commented Aug 24, 2023

This PR adds the ability to impersonate a user through a drop down menu on the user list:

Screenshot 2023-08-24 at 07 59 51

There is an add-on for this, but it would be good to bring it into core.

Once impersonating it adds a little 'stop impersonating' icon to the bottom right, that @jackmcdade should really do some magic on to make it more 'rad'.

@ryanmitchell ryanmitchell changed the title Add ability to impersonate a user [4.x] Add ability to impersonate a user Aug 24, 2023
@jacksleight
Copy link
Contributor

jacksleight commented Aug 24, 2023

Hey Ryan, this is awesome!

A while back I submitted a PR to the addon that made the login quiet, that way the last login date doesn’t change when you start/stop impersonation (which IMO it shouldn’t). The implementation uses the same approach as Eloquent’s save quietly method.

Be great if this could do the same. What do you think? I haven’t tested this so apologies if that’s already covered.

@ryanmitchell
Copy link
Contributor Author

Certainly. That should be there now.

@jasonvarga
Copy link
Member

jasonvarga commented Aug 24, 2023

This is cool.

I know it's a draft but FYI when I click "back to my account", it just removes the impersonation status and I'm still logged in as who I was impersonating.

@duncanmcclean
Copy link
Member

One thought: it might be good to have an option to disable this feature.

We have some sites where Statamic is used off the back of a Laravel app and we don't want admins impersonating users (they could change stuff they shouldn't be able to).

@ryanmitchell
Copy link
Contributor Author

@jasonvarga that was me being dumb. Fixed now.
@duncanmcclean of course, anything for you.

This should be good apart from the styling of the button :)

@ryanmitchell ryanmitchell marked this pull request as ready for review September 11, 2023 13:31
@jackmcdade jackmcdade merged commit 438ad5a into statamic:4.x Sep 19, 2023
16 checks passed
@jackmcdade
Copy link
Member

Thanks for this @ryanmitchell!

@ryanmitchell ryanmitchell deleted the feature/impersonate-users branch September 19, 2023 05:32
@ryanmitchell
Copy link
Contributor Author

Thanks for making it look better!

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

Successfully merging this pull request may close these issues.

None yet

5 participants