fusio icon indicating copy to clipboard operation
fusio copied to clipboard

User Change Status Event

Open mlohoar opened this issue 5 years ago • 3 comments

I'm trying to use the User change Status event and I think this is dispatched incorrectly with the system as the context.

I 'think' this is because the vendor/fusio/impl/src/Service/User->changeStatus is passed an anonymous context from Activate->activate($token).

What this means is the the event is triggered with old and new status, but the event does not include any information about which user the status changed for!?!

ChangedStatusEvent needs to have an additional property added of $userId

Thanks

mlohoar avatar Aug 02 '20 16:08 mlohoar

Hi, so the activate endpoint is triggered to activate a new registered user. Therefor I think the anonymous context is fine since we cant know who has requested the endpoint. But we could indeed add the user id of the user who is affected by the status change. Would you like to create a PR for this?

chriskapp avatar Aug 03 '20 18:08 chriskapp

Hi, Yes it would seem sensible to add the user id to the event as I'm not sure what use the event is without it. To get me going, I replicated the decoding of the token in order to re-identify the user. So yes. Do I create a PR or do you? It's not urgent for me as I have a work around. Thanks

mlohoar avatar Aug 03 '20 21:08 mlohoar

If you like feel free to create the PR, otherwise I can also add the parameter.

chriskapp avatar Aug 05 '20 17:08 chriskapp