Skip to content

Commit f2c7dfc

Browse files
committed
refactoring custom user provider and admin user controller
1 parent 8fe267a commit f2c7dfc

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/Legislator/LegislatorBundle/Controller/AdminUserController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public function processGroupFromAction($id)
4242
}
4343

4444
$em = $this->getDoctrine()->getEntityManager();
45-
$em->persist($group);
46-
$em->flush($user);
45+
$em->persist($user);
46+
$em->flush();
4747

4848
return $this->redirect($this->generateUrl('legislator_user_list'));
4949
}

src/Legislator/LegislatorBundle/Resources/config/services.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ parameters:
44
services:
55
legislator_user.provider:
66
class: Legislator\LegislatorBundle\Security\LegislatorUserProvider
7-
arguments: ["@fos_user.user_manager", "@service_container", "%cosign_login_enabled%"]
7+
arguments: ["@fos_user.user_manager", "@service_container"]
88

99
legislator_user.registration.form.type:
1010
class: Legislator\LegislatorBundle\Form\RegistrationFormType

src/Legislator/LegislatorBundle/Security/LegislatorUserProvider.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
use Symfony\Component\Security\Core\User\UserInterface as SecurityUserInterface;
77
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
88
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
9-
use Symfony\Component\DependencyInjection\Container;
109
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
10+
use Symfony\Component\DependencyInjection\ContainerInterface;
1111

1212
use FOS\UserBundle\Model\User;
1313
use FOS\UserBundle\Model\UserInterface;
@@ -16,11 +16,12 @@
1616

1717
class LegislatorUserProvider implements UserProviderInterface {
1818

19-
public function __construct(UserManagerInterface $userManager, Container $container, $cosign_login_enabled=FALSE)
19+
public function __construct(UserManagerInterface $userManager, ContainerInterface $container)
2020
{
2121
$this->userManager = $userManager;
2222
$this->container = $container;
23-
$this->cosign_login_enabled = $cosign_login_enabled;
23+
24+
$this->cosign_login_enabled = $this->container->getParameter('cosign_login_enabled');
2425
}
2526

2627
public function loadUserByUsername($username)
@@ -58,7 +59,6 @@ public function loadUserByUsername($username)
5859

5960
$this->userManager->updateUser($user);
6061

61-
6262
} else {
6363
if (!$user) {
6464
throw new UsernameNotFoundException(sprintf('Username "%s" does not exist.', $username));

0 commit comments

Comments
 (0)