diff --git a/Resources/config/services.yml b/Resources/config/services.yml index fb5ec4f..d278889 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -48,3 +48,13 @@ services: pugx_user_discriminator: alias: pugx_user.manager.user_discriminator + # user providers + pugx_multi_user.user_provider.username: + class: PUGX\MultiUserBundle\Security\UserProvider + arguments: ["@fos_user.user_manager"] + public: false + + pugx_multi_user.user_provider.username_email: + class: PUGX\MultiUserBundle\Security\EmailUserProvider + arguments: ["@fos_user.user_manager"] + public: false diff --git a/Security/EmailUserProvider.php b/Security/EmailUserProvider.php new file mode 100644 index 0000000..4e8724d --- /dev/null +++ b/Security/EmailUserProvider.php @@ -0,0 +1,13 @@ +userManager->getClass(); + return $userClass === $class || is_subclass_of($class, $userClass) || + (get_parent_class($class) === get_parent_class($userClass) && get_parent_class($class) !== false); + } +} diff --git a/Security/UserProvider.php b/Security/UserProvider.php new file mode 100644 index 0000000..44e2d86 --- /dev/null +++ b/Security/UserProvider.php @@ -0,0 +1,13 @@ +userManager->getClass(); + return $userClass === $class || is_subclass_of($class, $userClass) || + (get_parent_class($class) === get_parent_class($userClass) && get_parent_class($class) !== false); + } +}