Your project should use Doctrine migrations
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/composer.using_migrations
Your project controllers should only contains actions as public methods 12
- Read doc
- Productivity
- Major
More information: https://insight.symfony.com/what-we-analyse/symfony.controller.non_action_public_method_in_controller_class
- $entityManager->getFilters()->disable('softdeleteable');
- // @codeCoverageIgnoreEnd
- }
- }
- public function configureFilters(Filters $filters): Filters
- {
- $filters->add(
- SoftDeleteFilter::new(
- 'deletedAt',
- $this->translator->trans('enabel_user.admin.form.showDeleted')
- );
- return parent::configureFilters($filters);
- }
- public function configureCrud(Crud $crud): Crud
- {
- return $crud
- ->setPageTitle(Crud::PAGE_INDEX, 'enabel_user.admin.title.manage_users')
- ->setPageTitle(Crud::PAGE_NEW, 'enabel_user.admin.title.new_user')
- ->setPageTitle(Crud::PAGE_EDIT, 'enabel_user.admin.title.edit_user')
- ->setSearchFields(['id', 'email', 'displayName'])
- ->setEntityPermission(User::ADMIN)
- ;
- }
- public function configureActions(Actions $actions): Actions
- {
- $actions = parent::configureActions($actions);
- /** @var User $currentUser */
- $currentUser = $this->getUser();
- }
- /**
- * @return iterable<FieldInterface>
- */
- public function configureFields(string $pageName): iterable
- {
- /** @var User $currentUser */
- $currentUser = $this->getUser();
- /** @var AdminContext $context */
- $context = $this->adminContextProvider->getContext();
- /**
- * @param EntityManagerInterface $entityManager
- * @param User $entityInstance
- */
- public function persistEntity(EntityManagerInterface $entityManager, $entityInstance): void
- {
- /** @var UserPasswordHasherInterface $hasher */
- $hasher = $this->container->get('security.password_hasher');
- $plainPassword = $entityInstance->getPlainPassword();
- if ($plainPassword !== null) {
- /**
- * @param EntityManagerInterface $entityManager
- * @param User $entityInstance
- */
- public function updateEntity(EntityManagerInterface $entityManager, $entityInstance): void
- {
- /** @var UserPasswordHasherInterface $hasher */
- $hasher = $this->container->get('security.password_hasher');
- $plainPassword = $entityInstance->getPlainPassword();
- if ($plainPassword !== null) {
- $entityInstance->setPassword($password);
- }
- parent::updateEntity($entityManager, $entityInstance);
- }
- public function impersonate(AdminContext $context): RedirectResponse
- {
- if (!$this->isGranted('ROLE_ALLOWED_TO_SWITCH')) {
- throw new HttpException(Response::HTTP_UNAUTHORIZED);
- }
- }
- return new RedirectResponse($referer);
- }
- public function restoreUser(AdminContext $context): Response
- {
- if (!$this->isGranted('ROLE_SUPER_ADMIN')) {
- throw new HttpException(Response::HTTP_UNAUTHORIZED);
- }
- use Symfony\Component\HttpFoundation\RedirectResponse;
- use Symfony\Component\Routing\Annotation\Route;
- class AzureController extends AbstractController
- {
- #[Route(path: '/azure/login', name: 'enabel_azure_login')]
- public function azureLogin(ClientRegistry $clientRegistry): RedirectResponse
- {
- return $clientRegistry
- ->getClient('azure_o365')
- ->redirect(
- []
- );
- }
- /** @codeCoverageIgnore */
- #[Route(path: '/azure/check', name: 'enabel_azure_check')]
- public function azureCheck(): void
- {
- throw new \LogicException('This method can be blank - Intercepted by the oauth2 client');
- }
- }
- use Symfony\Component\Routing\Annotation\Route;
- use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
- class LocalController extends AbstractController
- {
- #[Route(path: '/auth/login', name: 'enabel_login')]
- public function login(AuthenticationUtils $authenticationUtils, ParameterBagInterface $parameterBag): Response
- {
- if (null !== $this->getUser()) {
- /** @var string $defaultTarget */
- $defaultTarget = $parameterBag->get('enabel_user.login_redirect_route');
- }
- /**
- * @return never
- */
- #[Route(path: '/auth/logout', name: 'enabel_logout')]
- public function logout(): Response
- {
- throw new \LogicException('This method can be blank - Intercepted by the logout key on your firewall.');
- }
- }
Text files should end with a valid new line character. 7
- Read doc
- Productivity
- Info
More information: https://insight.symfony.com/what-we-analyse/missing_e_o_l
- - uses: actions/checkout@v3
- - uses: actions/setup-python@v4
- with:
- python-version: 3.x
- - run: pip install mkdocs
- - run: mkdocs gh-deploy --force
- vendor/
- composer.lock
- .phpunit.result.cache
- /site
- - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
- - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
- **Happy coding**!
- enabel_user:
- resource: "../src/Controller/"
- type: attribute
- | displayName | JWT | user.displayname |
- | employeeId | JWT | user.employeeid |
- | jobTitle | JWT | user.jobtitle |
- | language | JWT | user.preferredlanguage |
- 7. That's it, you will now be able to connect with your Azure account.
- {
- ...
- yield from $this->userMenuEntry();
- ...
- ```
- title:
- edit_user: 'Edit a user'
- manage_users: 'Manage users'
- new_user: 'Add a user'
- user: User
- users: Users