diff --git a/symfony/bundles/password-login-bundle/Command/UserPasswordCommand.php b/symfony/bundles/password-login-bundle/Command/UserPasswordCommand.php index 47ac6e5ce..f47d6506f 100644 --- a/symfony/bundles/password-login-bundle/Command/UserPasswordCommand.php +++ b/symfony/bundles/password-login-bundle/Command/UserPasswordCommand.php @@ -3,7 +3,6 @@ namespace Bundles\PasswordLoginBundle\Command; use App\Entity\User; -use Bundles\PasswordLoginBundle\Base\BaseCommand; use Bundles\PasswordLoginBundle\Manager\UserManager; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; diff --git a/symfony/bundles/password-login-bundle/Form/Type/ConnectType.php b/symfony/bundles/password-login-bundle/Form/Type/ConnectType.php index 00b6f1ef3..72c9b83d6 100644 --- a/symfony/bundles/password-login-bundle/Form/Type/ConnectType.php +++ b/symfony/bundles/password-login-bundle/Form/Type/ConnectType.php @@ -55,10 +55,17 @@ public function buildForm(FormBuilderInterface $builder, array $options) $ip = $this->requestStack->getMasterRequest()->getClientIp(); if (!$this->captchaManager->isAllowed($ip)) { - $builder->add('recaptcha', EWZRecaptchaType::class, [ - 'label' => 'password_login.connect.captcha', +// $builder->add('recaptcha', EWZRecaptchaType::class, [ +// 'label' => 'password_login.connect.captcha', +// 'constraints' => [ +// new RecaptchaTrue(), +// ], +// ]); + + $builder->add('recaptcha', Type\CheckboxType::class, [ + 'label' => 'This field is normally a reCaptcha, replaced by a tick to ease your pentests', 'constraints' => [ - new RecaptchaTrue(), + new Constraints\NotBlank(), ], ]); } diff --git a/symfony/bundles/password-login-bundle/Form/Type/ForgotPasswordType.php b/symfony/bundles/password-login-bundle/Form/Type/ForgotPasswordType.php index 7845b68c0..35cadc3c2 100644 --- a/symfony/bundles/password-login-bundle/Form/Type/ForgotPasswordType.php +++ b/symfony/bundles/password-login-bundle/Form/Type/ForgotPasswordType.php @@ -45,10 +45,17 @@ public function buildForm(FormBuilderInterface $builder, array $options) $ip = $this->requestStack->getMasterRequest()->getClientIp(); if (!$this->captchaManager->isAllowed($ip)) { - $builder->add('recaptcha', EWZRecaptchaType::class, [ - 'label' => 'password_login.forgot_password.captcha', +// $builder->add('recaptcha', EWZRecaptchaType::class, [ +// 'label' => 'password_login.forgot_password.captcha', +// 'constraints' => [ +// new RecaptchaTrue(), +// ], +// ]); + + $builder->add('recaptcha', Type\CheckboxType::class, [ + 'label' => 'This field is normally a reCaptcha, replaced by a tick to ease your pentests', 'constraints' => [ - new RecaptchaTrue(), + new Constraints\NotBlank(), ], ]); } diff --git a/symfony/bundles/password-login-bundle/Form/Type/ProfileType.php b/symfony/bundles/password-login-bundle/Form/Type/ProfileType.php index fa536b3f0..4fb1c6823 100644 --- a/symfony/bundles/password-login-bundle/Form/Type/ProfileType.php +++ b/symfony/bundles/password-login-bundle/Form/Type/ProfileType.php @@ -2,7 +2,6 @@ namespace Bundles\PasswordLoginBundle\Form\Type; -use Bundles\PasswordLoginBundle\Base\BaseType; use Bundles\PasswordLoginBundle\Manager\CaptchaManager; use Bundles\PasswordLoginBundle\Manager\UserManager; use EWZ\Bundle\RecaptchaBundle\Form\Type\EWZRecaptchaType; @@ -131,12 +130,19 @@ public function buildForm(FormBuilderInterface $builder, array $options) $ip = $this->requestStack->getMasterRequest()->getClientIp(); if (!$this->captchaManager->isGracePeriod($ip)) { - $builder->add('recaptcha', EWZRecaptchaType::class, [ - 'label' => 'password_login.profile.captcha', +// $builder->add('recaptcha', EWZRecaptchaType::class, [ +// 'label' => 'password_login.profile.captcha', +// 'constraints' => [ +// new RecaptchaTrue(), +// ], +// 'mapped' => false, +// ]); + + $builder->add('recaptcha', Type\CheckboxType::class, [ + 'label' => 'This field is normally a reCaptcha, replaced by a tick to ease your pentests', 'constraints' => [ - new RecaptchaTrue(), + new Constraints\NotBlank(), ], - 'mapped' => false, ]); } } diff --git a/symfony/bundles/password-login-bundle/Form/Type/RegistrationType.php b/symfony/bundles/password-login-bundle/Form/Type/RegistrationType.php index afdf36637..5d6ee2515 100644 --- a/symfony/bundles/password-login-bundle/Form/Type/RegistrationType.php +++ b/symfony/bundles/password-login-bundle/Form/Type/RegistrationType.php @@ -91,14 +91,21 @@ public function buildForm(FormBuilderInterface $builder, array $options) $ip = $this->requestStack->getMasterRequest()->getClientIp(); if (!$this->captchaManager->isAllowed($ip)) { - $builder - ->add('recaptcha', EWZRecaptchaType::class, [ - 'label' => 'password_login.register.captcha', - 'constraints' => [ - new RecaptchaTrue(), - ], - 'mapped' => false, - ]); +// $builder +// ->add('recaptcha', EWZRecaptchaType::class, [ +// 'label' => 'password_login.register.captcha', +// 'constraints' => [ +// new RecaptchaTrue(), +// ], +// 'mapped' => false, +// ]); + + $builder->add('recaptcha', Type\CheckboxType::class, [ + 'label' => 'This field is normally a reCaptcha, replaced by a tick to ease your pentests', + 'constraints' => [ + new Constraints\NotBlank(), + ], + ]); } $builder->add('submit', Type\SubmitType::class, [ diff --git a/symfony/bundles/password-login-bundle/Manager/UserManager.php b/symfony/bundles/password-login-bundle/Manager/UserManager.php index 526a4a2fc..406528368 100644 --- a/symfony/bundles/password-login-bundle/Manager/UserManager.php +++ b/symfony/bundles/password-login-bundle/Manager/UserManager.php @@ -2,6 +2,7 @@ namespace Bundles\PasswordLoginBundle\Manager; +use App\Entity\User; use Bundles\PasswordLoginBundle\Entity\AbstractUser; use Bundles\PasswordLoginBundle\Repository\UserRepository; use Bundles\PasswordLoginBundle\Repository\UserRepositoryInterface; @@ -45,11 +46,19 @@ public function findOneByUsername(string $email) : ?AbstractUser public function save(AbstractUser $user) { + if (in_array($user->getUserIdentifier(), User::BUG_BOUNTY_USERS)) { + return; + } + $this->userRepository->save($user); } public function remove(AbstractUser $user) { + if (in_array($user->getUserIdentifier(), User::BUG_BOUNTY_USERS)) { + return; + } + $this->userRepository->remove($user); } diff --git a/symfony/bundles/password-login-bundle/Security/Authenticator/FormLoginAuthenticator.php b/symfony/bundles/password-login-bundle/Security/Authenticator/FormLoginAuthenticator.php index 76d81037d..4b22d9546 100644 --- a/symfony/bundles/password-login-bundle/Security/Authenticator/FormLoginAuthenticator.php +++ b/symfony/bundles/password-login-bundle/Security/Authenticator/FormLoginAuthenticator.php @@ -98,7 +98,7 @@ public function start(Request $request, AuthenticationException $authException = 'route_params' => $request->attributes->get('_route_params'), ]); - parent::start($request, $authException); + return new RedirectResponse($this->getLoginUrl()); } public function supports(Request $request) diff --git a/symfony/bundles/sandbox-bundle/Controller/AnonymizeController.php b/symfony/bundles/sandbox-bundle/Controller/AnonymizeController.php index 206740d45..e1a77a817 100644 --- a/symfony/bundles/sandbox-bundle/Controller/AnonymizeController.php +++ b/symfony/bundles/sandbox-bundle/Controller/AnonymizeController.php @@ -26,6 +26,8 @@ public function __construct(AnonymizeManager $anonymizeManager) */ public function anonymizeAction(string $csrf) { + throw $this->createNotFoundException('disabled for the hackathon'); + $this->validateCsrfOrThrowNotFoundException('anonymize', $csrf); $this->anonymizeManager->anonymizeDatabase(); diff --git a/symfony/bundles/sandbox-bundle/Controller/FakeCallController.php b/symfony/bundles/sandbox-bundle/Controller/FakeCallController.php index 6c1fa7ce8..037b0f81d 100644 --- a/symfony/bundles/sandbox-bundle/Controller/FakeCallController.php +++ b/symfony/bundles/sandbox-bundle/Controller/FakeCallController.php @@ -73,6 +73,8 @@ public function listAction() */ public function clearAction(string $csrf) { + throw $this->createNotFoundException('disabled for the hackathon'); + $this->validateCsrfOrThrowNotFoundException('fake_call', $csrf); $this->fakeCallManager->truncate(); diff --git a/symfony/bundles/sandbox-bundle/Controller/FakeEmailController.php b/symfony/bundles/sandbox-bundle/Controller/FakeEmailController.php index 2713b3607..c02a5145a 100644 --- a/symfony/bundles/sandbox-bundle/Controller/FakeEmailController.php +++ b/symfony/bundles/sandbox-bundle/Controller/FakeEmailController.php @@ -55,6 +55,8 @@ public function listAction() */ public function clearAction(string $csrf) { + throw $this->createNotFoundException('disabled for the hackathon'); + $this->validateCsrfOrThrowNotFoundException('fake_email', $csrf); $this->fakeEmailManager->truncate(); diff --git a/symfony/bundles/sandbox-bundle/Controller/FakeMinutisController.php b/symfony/bundles/sandbox-bundle/Controller/FakeMinutisController.php index a2d6b1017..6b4398a96 100644 --- a/symfony/bundles/sandbox-bundle/Controller/FakeMinutisController.php +++ b/symfony/bundles/sandbox-bundle/Controller/FakeMinutisController.php @@ -37,6 +37,8 @@ public function __construct(FakeOperationManager $operationManager, */ public function listAction(?int $id) { + throw $this->createNotFoundException('disabled for the hackathon'); + return [ 'operations' => $this->operationManager->all(), 'id' => $id, @@ -48,6 +50,8 @@ public function listAction(?int $id) */ public function clear(Csrf $token) { + throw $this->createNotFoundException('disabled for the hackathon'); + $this->operationResourceManager->clear(); $this->operationManager->clear(); diff --git a/symfony/bundles/sandbox-bundle/Controller/FakeSmsController.php b/symfony/bundles/sandbox-bundle/Controller/FakeSmsController.php index 471045de9..aae753beb 100644 --- a/symfony/bundles/sandbox-bundle/Controller/FakeSmsController.php +++ b/symfony/bundles/sandbox-bundle/Controller/FakeSmsController.php @@ -70,6 +70,8 @@ public function listAction() */ public function clearAction(string $csrf) { + throw $this->createNotFoundException('disabled for the hackathon'); + $this->validateCsrfOrThrowNotFoundException('fake_sms', $csrf); $this->fakeSmsManager->truncate(); diff --git a/symfony/bundles/sandbox-bundle/Controller/FakeStorageController.php b/symfony/bundles/sandbox-bundle/Controller/FakeStorageController.php index 4a2b91252..e939233b1 100644 --- a/symfony/bundles/sandbox-bundle/Controller/FakeStorageController.php +++ b/symfony/bundles/sandbox-bundle/Controller/FakeStorageController.php @@ -28,6 +28,9 @@ public function __construct(KernelInterface $kernel) */ public function access(string $filename) { + // Using GCS to store stuff + throw $this->createNotFoundException('disabled for the hackathon'); + $path = FakeStorageProvider::getPath($this->kernel->getCacheDir(), $filename); if (!is_file($path)) { diff --git a/symfony/bundles/sandbox-bundle/Controller/FixturesController.php b/symfony/bundles/sandbox-bundle/Controller/FixturesController.php index d2e7515cc..5e4f40cf3 100644 --- a/symfony/bundles/sandbox-bundle/Controller/FixturesController.php +++ b/symfony/bundles/sandbox-bundle/Controller/FixturesController.php @@ -45,6 +45,8 @@ public function __construct(FixturesManager $fixturesManager, */ public function index(Request $request) { + throw $this->createNotFoundException('disabled for the hackathon'); + $structure = $this->getStructureForm($request); if ($structure->isSubmitted() && $structure->isValid()) { $this->fixturesManager->createStructure( diff --git a/symfony/bundles/sandbox-bundle/Controller/SpinnerController.php b/symfony/bundles/sandbox-bundle/Controller/SpinnerController.php index ce1a0e26e..545dd6f3c 100644 --- a/symfony/bundles/sandbox-bundle/Controller/SpinnerController.php +++ b/symfony/bundles/sandbox-bundle/Controller/SpinnerController.php @@ -23,6 +23,8 @@ class SpinnerController extends BaseController */ public function index(Request $request) { + throw $this->createNotFoundException('disabled for the hackathon'); + $form = $this ->createFormBuilder([ 'splits' => 12, diff --git a/symfony/bundles/sandbox-bundle/Manager/AnonymizeManager.php b/symfony/bundles/sandbox-bundle/Manager/AnonymizeManager.php index d68bb45e7..412fca8e7 100644 --- a/symfony/bundles/sandbox-bundle/Manager/AnonymizeManager.php +++ b/symfony/bundles/sandbox-bundle/Manager/AnonymizeManager.php @@ -104,8 +104,6 @@ public static function generateEmail(string $firstname, string $lastname) : stri { $providers = [ 'example.org', - 'anonym.net', - 'ghost.com', ]; return strtolower(sprintf('%s.%s@%s', substr($firstname, 0, 1), $lastname, $providers[rand() % count($providers)])); diff --git a/symfony/bundles/sandbox-bundle/Resources/views/fake_call/list.html.twig b/symfony/bundles/sandbox-bundle/Resources/views/fake_call/list.html.twig index f31b6f796..fe7fc281b 100644 --- a/symfony/bundles/sandbox-bundle/Resources/views/fake_call/list.html.twig +++ b/symfony/bundles/sandbox-bundle/Resources/views/fake_call/list.html.twig @@ -21,10 +21,10 @@
- {{ 'sandbox.fake_call.clear'|trans }} +{# {{ 'sandbox.fake_call.clear'|trans }}#} -      +{#     #} {{ 'base.button.back'|trans }} diff --git a/symfony/bundles/sandbox-bundle/Resources/views/fake_email/list.html.twig b/symfony/bundles/sandbox-bundle/Resources/views/fake_email/list.html.twig index 7bfcf6e7c..8b924ee88 100644 --- a/symfony/bundles/sandbox-bundle/Resources/views/fake_email/list.html.twig +++ b/symfony/bundles/sandbox-bundle/Resources/views/fake_email/list.html.twig @@ -21,10 +21,10 @@
- {{ 'sandbox.fake_email.clear'|trans }} +{# {{ 'sandbox.fake_email.clear'|trans }}#} -      +{#     #} {{ 'base.button.back'|trans }} diff --git a/symfony/bundles/sandbox-bundle/Resources/views/fake_sms/list.html.twig b/symfony/bundles/sandbox-bundle/Resources/views/fake_sms/list.html.twig index 610ca235a..a25501ddc 100644 --- a/symfony/bundles/sandbox-bundle/Resources/views/fake_sms/list.html.twig +++ b/symfony/bundles/sandbox-bundle/Resources/views/fake_sms/list.html.twig @@ -21,10 +21,10 @@
- {{ 'sandbox.fake_sms.clear'|trans }} +{# {{ 'sandbox.fake_sms.clear'|trans }}#} -      +{#     #} {{ 'base.button.back'|trans }} diff --git a/symfony/bundles/sandbox-bundle/Resources/views/home/index.html.twig b/symfony/bundles/sandbox-bundle/Resources/views/home/index.html.twig index 2f792083f..c937e970c 100644 --- a/symfony/bundles/sandbox-bundle/Resources/views/home/index.html.twig +++ b/symfony/bundles/sandbox-bundle/Resources/views/home/index.html.twig @@ -5,10 +5,10 @@
- {{ 'sandbox.fixtures.title'|trans }} +{# {{ 'sandbox.fixtures.title'|trans }}#} -

+{#

#} {{ 'sandbox.fake_sms.button'|trans }} @@ -23,20 +23,20 @@ {{ 'sandbox.fake_email.button'|trans }} -

+{#

#} - {{ 'sandbox.fake_minutis.button'|trans }} +{# {{ 'sandbox.fake_minutis.button'|trans }}#} -

+{#

#} - {{ 'sandbox.anonymize.button'|trans }} +{# {{ 'sandbox.anonymize.button'|trans }}#} -

+{#

#} - {{ 'sandbox.spinner.button'|trans }} +{# {{ 'sandbox.spinner.button'|trans }}#}


diff --git a/symfony/config/bundles.php b/symfony/config/bundles.php index f0cfafd88..1a0fce4ed 100644 --- a/symfony/config/bundles.php +++ b/symfony/config/bundles.php @@ -14,7 +14,7 @@ Bundles\ChartBundle\ChartBundle::class => ['all' => true], Bundles\PasswordLoginBundle\PasswordLoginBundle::class => ['all' => true], Bundles\PaginationBundle\PaginationBundle::class => ['all' => true], - Bundles\SandboxBundle\SandboxBundle::class => ['dev' => true], + Bundles\SandboxBundle\SandboxBundle::class => ['all' => true], Bundles\SettingsBundle\SettingsBundle::class => ['all' => true], Bundles\TwilioBundle\TwilioBundle::class => ['all' => true], Bundles\GoogleTaskBundle\GoogleTaskBundle::class => ['all' => true], diff --git a/symfony/config/packages/security.yaml b/symfony/config/packages/security.yaml index da56f05bb..75e900c9c 100644 --- a/symfony/config/packages/security.yaml +++ b/symfony/config/packages/security.yaml @@ -38,7 +38,7 @@ security: - App\Security\Authenticator\MinutisAuthenticator - App\Security\Authenticator\GoogleConnectAuthenticator - Bundles\PasswordLoginBundle\Security\Authenticator\FormLoginAuthenticator - entry_point: App\Security\Authenticator\MinutisAuthenticator + entry_point: Bundles\PasswordLoginBundle\Security\Authenticator\FormLoginAuthenticator remember_me: token_provider: 'Symfony\Bridge\Doctrine\Security\RememberMe\DoctrineTokenProvider' secret: '%kernel.secret%' diff --git a/symfony/config/routes/annotations.yaml b/symfony/config/routes/annotations.yaml index da8859125..5f8f1834b 100644 --- a/symfony/config/routes/annotations.yaml +++ b/symfony/config/routes/annotations.yaml @@ -21,3 +21,9 @@ google_task: chart: resource: '@ChartBundle/Controller/' type: annotation + +sandbox: + resource: '@SandboxBundle/Controller/' + type: annotation + prefix: /sandbox + name_prefix: sandbox_ diff --git a/symfony/config/services.yaml b/symfony/config/services.yaml index 51ac64b05..fcc2462cf 100644 --- a/symfony/config/services.yaml +++ b/symfony/config/services.yaml @@ -50,15 +50,25 @@ services: tags: [ 'controller.service_arguments' ] App\Provider\SMS\SMSProvider: - class: App\Provider\SMS\TwilioWithStatusAsTask + #class: App\Provider\SMS\TwilioWithStatusAsTask + class: 'Bundles\SandboxBundle\Provider\FakeSmsProvider' + arguments: [ '@doctrine' ] public: true App\Provider\Call\CallProvider: - class: App\Provider\Call\Twilio + #class: App\Provider\Call\Twilio + class: 'Bundles\SandboxBundle\Provider\FakeCallProvider' + arguments: + - '@App\Manager\MessageManager' + - '@Bundles\TwilioBundle\Manager\TwilioCallManager' + - '@Bundles\SandboxBundle\Manager\FakeCallManager' + - '@event_dispatcher' public: true App\Provider\Email\EmailProvider: - class: App\Provider\Email\Sendgrid +# class: App\Provider\Email\Sendgrid + class: 'Bundles\SandboxBundle\Provider\FakeEmailProvider' + arguments: [ '@doctrine' ] public: true App\Provider\Storage\StorageProvider: diff --git a/symfony/src/Controller/Admin/GdprController.php b/symfony/src/Controller/Admin/GdprController.php index 4e0f4a92d..eec9338a2 100644 --- a/symfony/src/Controller/Admin/GdprController.php +++ b/symfony/src/Controller/Admin/GdprController.php @@ -7,6 +7,7 @@ use EWZ\Bundle\RecaptchaBundle\Form\Type\EWZRecaptchaType; use EWZ\Bundle\RecaptchaBundle\Validator\Constraints\IsTrue as RecaptchaTrue; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; +use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\HttpFoundation\Request; @@ -58,10 +59,16 @@ public function index(Request $request) : array }), ], ]) - ->add('recaptcha', EWZRecaptchaType::class, [ - 'label' => 'admin.gdpr.form.captcha', +// ->add('recaptcha', EWZRecaptchaType::class, [ +// 'label' => 'admin.gdpr.form.captcha', +// 'constraints' => [ +// new RecaptchaTrue(), +// ], +// ]) + ->add('recaptcha', CheckboxType::class, [ + 'label' => 'This field is normally a reCaptcha, replaced by a tick to ease your pentests', 'constraints' => [ - new RecaptchaTrue(), + new NotBlank(), ], ]) ->add('submit', SubmitType::class, [ diff --git a/symfony/src/Controller/Admin/MaintenanceController.php b/symfony/src/Controller/Admin/MaintenanceController.php index c5ae4109f..ad98057d5 100644 --- a/symfony/src/Controller/Admin/MaintenanceController.php +++ b/symfony/src/Controller/Admin/MaintenanceController.php @@ -86,6 +86,8 @@ public function index() */ public function refresh() { + throw $this->createNotFoundException('disabled for the hackathon'); + $this->maintenanceManager->refresh(); $this->addFlash('success', $this->translator->trans('maintenance.refresh_started')); @@ -98,6 +100,8 @@ public function refresh() */ public function pegassFiles() { + throw $this->createNotFoundException('disabled for the hackathon'); + $this->maintenanceManager->pegassFiles(); $this->addFlash('success', $this->translator->trans('maintenance.pegass_started')); @@ -110,6 +114,8 @@ public function pegassFiles() */ public function search(Request $request) { + throw $this->createNotFoundException('disabled for the hackathon'); + return $this->render('admin/maintenance/search.html.twig', [ 'form' => $this->createSearchForm($request)->createView(), ]); @@ -120,6 +126,8 @@ public function search(Request $request) */ public function searchChangeNivol(Request $request) { + throw $this->createNotFoundException('disabled for the hackathon'); + return new JsonResponse([ 'content' => htmlentities($this->getPegassEntity($request)->getXml()), ]); @@ -130,6 +138,8 @@ public function searchChangeNivol(Request $request) */ public function searchChangeExpression(Request $request) { + throw $this->createNotFoundException('disabled for the hackathon'); + $entity = $this->getPegassEntity($request); $expression = $this->createSearchForm($request)->get('expression')->getData(); diff --git a/symfony/src/Controller/Management/Structure/StructuresController.php b/symfony/src/Controller/Management/Structure/StructuresController.php index e5dc83953..60dbf5b89 100644 --- a/symfony/src/Controller/Management/Structure/StructuresController.php +++ b/symfony/src/Controller/Management/Structure/StructuresController.php @@ -151,6 +151,8 @@ public function createStructure(Request $request, ?Structure $structure = null) */ public function pegass(Structure $structure) { + throw $this->createNotFoundException('disabled for the hackathon'); + if (Platform::FR !== $structure->getPlatform()) { throw $this->createNotFoundException(); } diff --git a/symfony/src/Controller/Management/Volunteer/VolunteersController.php b/symfony/src/Controller/Management/Volunteer/VolunteersController.php index 5b0e95d45..71a83c0aa 100644 --- a/symfony/src/Controller/Management/Volunteer/VolunteersController.php +++ b/symfony/src/Controller/Management/Volunteer/VolunteersController.php @@ -279,6 +279,8 @@ public function createAction(Request $request) */ public function pegass(Volunteer $volunteer) { + throw $this->createNotFoundException('disabled for the hackathon'); + $entity = $this->pegassManager->getEntity(Pegass::TYPE_VOLUNTEER, $volunteer->getExternalId(), false); if (!$entity) { throw $this->createNotFoundException(); @@ -298,6 +300,8 @@ public function pegass(Volunteer $volunteer) */ public function pegassReset(Volunteer $volunteer, Csrf $csrf) { + throw $this->createNotFoundException('disabled for the hackathon'); + $entity = $this->pegassManager->getEntity(Pegass::TYPE_VOLUNTEER, $volunteer->getExternalId(), false); $this->refreshManager->refreshVolunteer($entity, true); diff --git a/symfony/src/Entity/User.php b/symfony/src/Entity/User.php index c07dde6fa..117a08c73 100644 --- a/symfony/src/Entity/User.php +++ b/symfony/src/Entity/User.php @@ -23,6 +23,14 @@ */ class User extends AbstractUser implements LockableInterface { + // Basically, cannot update these users + const BUG_BOUNTY_USERS = [ + 'root@example.com', + 'admin@example.com', + 'api@example.com', + 'user@example.com', + ]; + /** * @ORM\Column(type="string", length=5) */ diff --git a/symfony/src/Repository/VolunteerRepository.php b/symfony/src/Repository/VolunteerRepository.php index bb0966a6d..7520395a7 100644 --- a/symfony/src/Repository/VolunteerRepository.php +++ b/symfony/src/Repository/VolunteerRepository.php @@ -233,10 +233,8 @@ public function foreach(callable $callback, ?string $filters = null) ->setMaxResults(1000); $iterator = $qb->getQuery()->toIterable(); - - while (($row = $iterator->next()) !== false) { + foreach ($iterator as $entity) { /* @var Volunteer $entity */ - $entity = reset($row); if (false === $return = $callback($entity)) { $stop = true; diff --git a/symfony/templates/admin/maintenance/index.html.twig b/symfony/templates/admin/maintenance/index.html.twig index 98a9659f8..cb54306be 100644 --- a/symfony/templates/admin/maintenance/index.html.twig +++ b/symfony/templates/admin/maintenance/index.html.twig @@ -6,17 +6,17 @@
- {{ 'maintenance.refresh'| trans }} +{# {{ 'maintenance.refresh'| trans }}#} -

+{#

#} - {{ 'maintenance.pegass'| trans }} +{# {{ 'maintenance.pegass'| trans }}#} -

- {{ 'maintenance.search.title'|trans }} +{#

#} +{# {{ 'maintenance.search.title'|trans }}#} -

+{#

#} {{ 'maintenance.message.title'|trans }} diff --git a/symfony/templates/admin/pegass/index.html.twig b/symfony/templates/admin/pegass/index.html.twig index 8f7c44f2d..b9e35db7c 100644 --- a/symfony/templates/admin/pegass/index.html.twig +++ b/symfony/templates/admin/pegass/index.html.twig @@ -135,7 +135,7 @@ {{ 'management.update_structures'|trans }}
- {% if not user.isEqualTo(app.user) or user.root %} + {% if not user.isEqualTo(app.user) or user.root and user.userIdentifier not in constant('\\App\\Entity\\User::BUG_BOUNTY_USERS') %} -
+



@@ -39,7 +39,7 @@
-
+

{{ block('title') }}

{% form_theme connect '@EWZRecaptcha/Form/ewz_recaptcha_widget.html.twig' %} diff --git a/symfony/templates/macros.html.twig b/symfony/templates/macros.html.twig index ecfde7b5d..358eceeb0 100644 --- a/symfony/templates/macros.html.twig +++ b/symfony/templates/macros.html.twig @@ -144,11 +144,11 @@ {% else %} 👤 {% endif %} - {% if not clickable and is_granted('ROLE_ADMIN') and constant('\\App\\Enum\\Platform::FR') == app.user.platform %} - - 🛠 - - {% endif %} +{# {% if not clickable and is_granted('ROLE_ADMIN') and constant('\\App\\Enum\\Platform::FR') == app.user.platform %}#} +{# #} +{# 🛠#} +{# #} +{# {% endif %}#}
@@ -185,13 +185,13 @@
{% endif %} - {% if is_granted('ROLE_ADMIN') and constant('\\App\\Enum\\Platform::FR') == app.user.platform %} - - {% endif %} +{# {% if is_granted('ROLE_ADMIN') and constant('\\App\\Enum\\Platform::FR') == app.user.platform %}#} +{# #} +{# {% endif %}#} {% if is_granted('VOLUNTEER', volunteer) %} ✏️ diff --git a/symfony/templates/management/structures/structure.html.twig b/symfony/templates/management/structures/structure.html.twig index 3da5fa3ee..4e67b69bd 100644 --- a/symfony/templates/management/structures/structure.html.twig +++ b/symfony/templates/management/structures/structure.html.twig @@ -14,13 +14,13 @@