PUGX / PUGXMultiUserBundle

An extension for FOSUserBundle to handle users of different types. Compatible with Doctrine ORM.
163 stars 96 forks source link

PUGX UserProviders to fix supportsClass return value in FOS UserProviders #119

Open christoph-pflueger opened 7 years ago

christoph-pflueger commented 7 years ago

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.