Change code to make first user an admin so they have access to reference editor
This commit is contained in:
		| @@ -20,6 +20,11 @@ class RegistrationController extends AbstractController | ||||
|  | ||||
|         $form = $this->createForm(RegistrationFormType::class, $user); | ||||
|         $form->handleRequest($request); | ||||
|         $role = ['ROLE_USER']; | ||||
|  | ||||
|         if ($entityManager->getRepository(User::class)->getUserCount() == 0) { | ||||
|             $role = ['ROLE_ADMIN']; | ||||
|         } | ||||
|  | ||||
|         if ($form->isSubmitted() && $form->isValid()) { | ||||
|             // encode the plain password | ||||
| @@ -28,8 +33,8 @@ class RegistrationController extends AbstractController | ||||
|                     $user, | ||||
|                     $form->get('plainPassword')->getData() | ||||
|                 ) | ||||
|             ) | ||||
|             ->setRoles(['ROLE_USER']); | ||||
|             ); | ||||
|             $user->setRoles($role); | ||||
|  | ||||
|             $entityManager->persist($user); | ||||
|             $entityManager->flush(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user