diff --git a/config/packages/security.yml b/config/packages/security.yml index b3b6494798..0d8967ae22 100644 --- a/config/packages/security.yml +++ b/config/packages/security.yml @@ -70,6 +70,7 @@ security: # same pattern must be in routing_front.yml - { path: ^/login-as-remembered-user/$, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/admin/superadmin/, roles: ROLE_SUPER_ADMIN } + - { path: ^/admin/cron/*, roles: ROLE_SUPER_ADMIN } - { path: ^/admin/translation/list/$, roles: ROLE_SUPER_ADMIN } - { path: ^/admin/$, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/admin/authorization/$, roles: IS_AUTHENTICATED_ANONYMOUSLY } diff --git a/config/services/cron.yml b/config/services/cron.yml index a3ab945781..900b652700 100644 --- a/config/services/cron.yml +++ b/config/services/cron.yml @@ -7,4 +7,4 @@ services: # Example: # Shopsys\FrameworkBundle\Model\Product\Elasticsearch\ProductExportCronModule: # tags: -# - { name: shopsys.cron, hours: '*', minutes: '*' } +# - { name: shopsys.cron, hours: '*', minutes: '*', readableName: 'Product search export' } diff --git a/tests/App/Smoke/Http/RouteConfigCustomization.php b/tests/App/Smoke/Http/RouteConfigCustomization.php index a57cd54df7..815f7a063d 100644 --- a/tests/App/Smoke/Http/RouteConfigCustomization.php +++ b/tests/App/Smoke/Http/RouteConfigCustomization.php @@ -179,6 +179,27 @@ private function configureAdminRoutes(RouteConfigCustomizer $routeConfigCustomiz $config->changeDefaultRequestDataSet($debugNote) ->setExpectedStatusCode(302); }) + ->customizeByRouteName('admin_default_schedulecron', function (RouteConfig $config) { + $config->changeDefaultRequestDataSet('Standard admin is not allowed to schedule cron') + ->setExpectedStatusCode(302); + $config->addExtraRequestDataSet('Superadmin can schedule cron') + ->setAuth(new BasicHttpAuth('superadmin', 'admin123')) + ->setExpectedStatusCode(302); + }) + ->customizeByRouteName('admin_default_cronenable', function (RouteConfig $config) { + $config->changeDefaultRequestDataSet('Standard admin is not allowed to enable cron') + ->setExpectedStatusCode(302); + $config->addExtraRequestDataSet('Superadmin can enable cron') + ->setAuth(new BasicHttpAuth('superadmin', 'admin123')) + ->setExpectedStatusCode(302); + }) + ->customizeByRouteName('admin_default_crondisable', function (RouteConfig $config) { + $config->changeDefaultRequestDataSet('Standard admin is not allowed to disable cron') + ->setExpectedStatusCode(302); + $config->addExtraRequestDataSet('Superadmin can disable cron') + ->setAuth(new BasicHttpAuth('superadmin', 'admin123')) + ->setExpectedStatusCode(302); + }) ->customizeByRouteName('admin_administrator_edit', function (RouteConfig $config) { $config->changeDefaultRequestDataSet('Standard admin is not allowed to edit superadmin (with ID 1)') ->setExpectedStatusCode(302);