PUGXMultiUserBundle icon indicating copy to clipboard operation
PUGXMultiUserBundle copied to clipboard

PUGX UserProviders to fix supportsClass return value in FOS UserProviders

Open christoph-pflueger opened this issue 8 years ago • 0 comments

Currently, switching back from an impersonated user to ones original account does not work. That's due to the fact that the FOSUserBundle compares the original account's class to the impersonated user's class in its own UserProvider when refreshing a user.

Example

Assuming you have two user types UserBundle\Entity\UserOne and UserBundle\Entity\UserTwo. When impersonating another UserOne with a UserOne account, everything works as expected. However, when impersonating a UserTwo with a UserOne account, the comparison backfires.

Propsed fix

Add custom PUGX UserProviders that extend the FOS UserProviders and override the existing supportsClass functions. By comparing the parent class of both users, everything works as expected.

christoph-pflueger avatar Sep 11 '16 16:09 christoph-pflueger