|
|
@@ -3,7 +3,7 @@ declare(strict_types=1);
|
|
|
|
|
|
namespace App\Service\Security;
|
|
|
|
|
|
-use Symfony\Component\Security\Core\Security;
|
|
|
+use App\Test\Service\Security\SwitchUserTest;
|
|
|
use Symfony\Component\Security\Core\User\UserInterface;
|
|
|
|
|
|
/**
|
|
|
@@ -12,13 +12,16 @@ use Symfony\Component\Security\Core\User\UserInterface;
|
|
|
*/
|
|
|
class SwitchUser
|
|
|
{
|
|
|
- private Security $security;
|
|
|
-
|
|
|
- public function __construct(Security $security)
|
|
|
+ public function __construct()
|
|
|
{
|
|
|
- $this->security = $security;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @param UserInterface $user
|
|
|
+ * @param UserInterface $user_to_switch
|
|
|
+ * @return bool
|
|
|
+ * @see SwitchUserTest::testIsAllowedToSwitch()
|
|
|
+ */
|
|
|
public function isAllowedToSwitch(UserInterface $user, UserInterface $user_to_switch):bool{
|
|
|
return $user->getChildren()->contains($user_to_switch);
|
|
|
}
|