mothership-ec / cog-mothership-user

Mothership User Cogule
Other
1 stars 1 forks source link

Add impersonate feature #19

Closed lsjroberts closed 11 years ago

lsjroberts commented 11 years ago

I accidently closed and merged the previous pull request #18 so here it is again.


We need to implement this feature as it exists on the current site:

@messagedigital/front-end-developers will likely also want to help figure out how this should look and where it should live.

See current system for current behavior (screenshot below).

screen shot 2013-09-17 at 15 24 44

lsjroberts commented 11 years ago

Regarding https://github.com/messagedigital/cog-mothership-user/pull/18#issuecomment-24598894 and https://github.com/messagedigital/cog-mothership-user/pull/18#issuecomment-24599063

@joeholdcroft @dannyhannah Should we go with events or a modification to the checkout?

joeholdcroft commented 11 years ago

@lsjroberts see my following comment:

Maybe we can be more clever by doing something like:

When in checkout, detect if the user is actually an admin impersonating a user If so, present an option to bypass SagePay and enter a MOTO reference instead (not sure how this would effect checkout flow). Your option may be more plausible for v1, though. What do you think @dannyhannah ?

lsjroberts commented 11 years ago

I've added the listener on cog-mothership-ecommerce:user-impersonate. This sets adds a field called place_order which allows you to do $this->get('http.session')->get('impersonate.data.place_order'). It needs some logic within the checkout process to see if that is true then skip payment.

@dannyhannah Should this be in Message\Mothership\Ecommerce\Controller\Checkout\Payment or elsewhere?

dannyhannah commented 11 years ago

I think it makes sense for it to go there for now.

lsjroberts commented 11 years ago

https://github.com/messagedigital/cog-mothership-ecommerce/tree/user-impersonate

lsjroberts commented 11 years ago

All works.

Though there is one issue which seems to be the same on the current system, after going to impersonate a user you then are logged in as them and therefore have no access to the admin area. Does that matter or is this all good to merge?

lsjroberts commented 11 years ago

https://github.com/messagedigital/cog-mothership-ecommerce/pull/69