diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index f9301caa6..267bb2008 100644 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -992,12 +992,12 @@ - - Thelia\Controller\Admin\CacheController::defaultAction + + Thelia\Controller\Admin\AdvancedConfigurationController::defaultAction - - Thelia\Controller\Admin\CacheController::flushAction + + Thelia\Controller\Admin\AdvancedConfigurationController::flushCacheAction diff --git a/core/lib/Thelia/Controller/Admin/AdminLogsController.php b/core/lib/Thelia/Controller/Admin/AdminLogsController.php index 18573bea0..afd2cf910 100644 --- a/core/lib/Thelia/Controller/Admin/AdminLogsController.php +++ b/core/lib/Thelia/Controller/Admin/AdminLogsController.php @@ -13,15 +13,14 @@ namespace Thelia\Controller\Admin; use Thelia\Core\Security\AccessManager; +use Thelia\Core\Security\Resource\AdminResources; use Thelia\Model\AdminLogQuery; class AdminLogsController extends BaseAdminController { - const RESOURCE_CODE = "admin.admin-logs"; - public function defaultAction() { - if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW)) return $response; + if (null !== $response = $this->checkAuth(AdminResources::ADMIN_LOG, array(), AccessManager::VIEW)) return $response; // Render the edition template. return $this->render('admin-logs'); diff --git a/core/lib/Thelia/Controller/Admin/CacheController.php b/core/lib/Thelia/Controller/Admin/CacheController.php deleted file mode 100644 index 8680d834c..000000000 --- a/core/lib/Thelia/Controller/Admin/CacheController.php +++ /dev/null @@ -1,61 +0,0 @@ - - */ -class CacheController extends BaseAdminController -{ - - public function defaultAction() - { - if (null !== $result = $this->checkAuth(AdminResources::CACHE, [], AccessManager::VIEW)) { - return $result; - } - - return $this->render('cache'); - } - - public function flushAction() - { - if (null !== $result = $this->checkAuth(AdminResources::CACHE, [], AccessManager::UPDATE)) { - return $result; - } - - $form = new CacheFlushForm($this->getRequest()); - try { - $this->validateForm($form); - - $event = new CacheEvent($this->container->getParameter("kernel.cache_dir")); - $this->dispatch(TheliaEvents::CACHE_CLEAR, $event); - - $event = new CacheEvent(THELIA_WEB_DIR . "assets"); - $this->dispatch(TheliaEvents::CACHE_CLEAR, $event); - - $this->redirectToRoute('admin.configuration.cache'); - } catch (FormValidationException $e) { - - } - } - -} diff --git a/core/lib/Thelia/Core/Security/Resource/AdminResources.php b/core/lib/Thelia/Core/Security/Resource/AdminResources.php index de78123b4..5e78efd7e 100644 --- a/core/lib/Thelia/Core/Security/Resource/AdminResources.php +++ b/core/lib/Thelia/Core/Security/Resource/AdminResources.php @@ -45,12 +45,12 @@ final class AdminResources const ADMINISTRATOR = "admin.configuration.administrator"; + const ADVANCED_CONFIGURATION = "admin.configuration.advanced"; + const AREA = "admin.configuration.area"; const ATTRIBUTE = "admin.configuration.attribute"; - const CACHE = "admin.cache"; - const CATEGORY = "admin.category"; const CONFIG = "admin.configuration"; @@ -91,7 +91,9 @@ final class AdminResources const TEMPLATE = "admin.configuration.template"; - const SYSTEM_LOG = "admin.configuration.system-log"; + const SYSTEM_LOG = "admin.configuration.system-logs"; + + const ADMIN_LOG = "admin.configuration.admin-logs"; const STORE = "admin.configuration.store"; diff --git a/setup/insert.sql b/setup/insert.sql index 5352e4d83..f7c5a2db8 100644 --- a/setup/insert.sql +++ b/setup/insert.sql @@ -1271,7 +1271,13 @@ INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES (23, 'admin.configuration.template', NOW(), NOW()), (24, 'admin.configuration.system-log', NOW(), NOW()), (25, 'admin.cache', NOW(), NOW()), -(26, 'admin.home', NOW(), NOW()); +(26, 'admin.home', NOW(), NOW()), +(27, 'admin.configuration.store', NOW(), NOW()), +(28, 'admin.configuration.variable', NOW(), NOW()), +(29, 'admin.configuration.admin-logs', NOW(), NOW()), +(30, 'admin.configuration.system-logs', NOW(), NOW()), +(31, 'admin.configuration.advanced', NOW(), NOW()), +(32, 'admin.configuration.translations', NOW(), NOW()); /** generated with command : php Thelia thelia:generate-resources --output sql-i18n @@ -1328,7 +1334,19 @@ INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES (25, 'en_US', 'Configuration / Cache'), (25, 'fr_FR', 'Configuration / Cache'), (26, 'en_US', 'Back-office home page'), -(26, 'fr_FR', 'Page d''acceuil de l''administration'); +(26, 'fr_FR', 'Page d''acceuil de l''administration'), +(27, 'en_US', 'Store information configuration'), +(27, 'fr_FR', 'Informations sur la boutique'), +(28, 'en_US', 'Configuration variables'), +(28, 'fr_FR', 'Variables de configuration'), +(29, 'en_US', 'View administration logs'), +(29, 'fr_FR', 'Consulter les logs d''administration'), +(30, 'en_US', 'Logging system configuration'), +(30, 'fr_FR', 'Configuration du système de log'), +(31, 'en_US', 'Advanced configuration'), +(31, 'fr_FR', 'Configuration avancée'), +(32, 'en_US', 'Translations'), +(32, 'fr_FR', 'Traductions'); INSERT INTO `message` (`id`, `name`, `secured`, `text_layout_file_name`, `text_template_file_name`, `html_layout_file_name`, `html_template_file_name`, `created_at`, `updated_at`) VALUES diff --git a/setup/update/2.0.1.sql b/setup/update/2.0.1.sql index 809007107..e1bf8e310 100644 --- a/setup/update/2.0.1.sql +++ b/setup/update/2.0.1.sql @@ -9,5 +9,59 @@ UPDATE `config` SET `value`='' WHERE `name`='thelia_extra_version'; ALTER TABLE `module` ADD INDEX `idx_module_activate` (`activate`); +SELECT @max := MAX(`id`) FROM `resource`; +SET @max := @max+1; + +INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES +(@max, 'admin.configuration.store', NOW(), NOW()); + +INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES +(@max, 'en_US', 'Store information configuration'), +(@max, 'fr_FR', 'Informations sur la boutique'); + +SET @max := @max+1; + +INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES +(@max, 'admin.configuration.variable', NOW(), NOW()); + +INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES +(@max, 'en_US', 'Configuration variables'), +(@max, 'fr_FR', 'Variables de configuration'); + +SET @max := @max+1; + +INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES + (@max, 'admin.configuration.admin-logs', NOW(), NOW()); + +INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES + (@max, 'en_US', 'View administration logs'), + (@max, 'fr_FR', 'Consulter les logs d\'administration'); + +SET @max := @max+1; + +INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES + (@max, 'admin.configuration.system-logs', NOW(), NOW()); + +INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES + (@max, 'en_US', 'Logging system configuration'), + (@max, 'fr_FR', 'Configuration du système de log'); + +SET @max := @max+1; + +INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES + (@max, 'admin.configuration.advanced', NOW(), NOW()); + +INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES + (@max, 'en_US', 'Advanced configuration'), + (@max, 'fr_FR', 'Configuration avancée'); + +SET @max := @max+1; + +INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES + (@max, 'admin.configuration.translations', NOW(), NOW()); + +INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES + (@max, 'en_US', 'Translations'), + (@max, 'fr_FR', 'Traductions'); SET FOREIGN_KEY_CHECKS = 1; diff --git a/templates/backOffice/default/I18n/fr_FR.php b/templates/backOffice/default/I18n/fr_FR.php index ff1cededd..812e7f221 100755 --- a/templates/backOffice/default/I18n/fr_FR.php +++ b/templates/backOffice/default/I18n/fr_FR.php @@ -50,6 +50,7 @@ return array( 'Administration logs' => 'Journal des logs', 'Administration profiles' => 'Profils d\'administration', 'Administrators' => 'Administrateurs', + 'Advanced configuration' => 'Configuration avancée', 'Afficher ce profil' => 'Afficher ce profil', 'All countries are assigned to a shipping zone.' => 'Tous les pays sont assignés à une zone de livraison.', 'All orders' => 'Toutes les commandes', @@ -472,7 +473,8 @@ return array( 'First orders' => 'Premières commandes', 'FirstName' => 'Prénom', 'Firstname' => 'Prénom', - 'Flush the cache' => 'Vider le cache', + 'Flush the Thelia internal cache' => 'Vider le cache interne de Thelia', + 'Flush the cache now' => 'Vider le cache maintenant', 'Folder created on %date_create. Last modification: %date_change' => 'Dossier créé le %date_create. Dernière modification le %date_change', 'Folder title' => 'Titre du dossier', 'Folders' => 'Dossiers', diff --git a/templates/backOffice/default/admin-layout.tpl b/templates/backOffice/default/admin-layout.tpl index 5e9f09cca..73bf88590 100644 --- a/templates/backOffice/default/admin-layout.tpl +++ b/templates/backOffice/default/admin-layout.tpl @@ -193,7 +193,7 @@ {/loop} - {loop name="menu-auth-config" type="auth" role="ADMIN" resource="admin.configuration.area" access="VIEW"} + {loop name="menu-auth-config" type="auth" role="ADMIN" resource="admin.configuration" access="VIEW"}
  • {intl l="Configuration"}
  • diff --git a/templates/backOffice/default/cache.html b/templates/backOffice/default/cache.html deleted file mode 100644 index 95c9b5178..000000000 --- a/templates/backOffice/default/cache.html +++ /dev/null @@ -1,31 +0,0 @@ -{extends file="admin-layout.tpl"} - -{block name="page-title"}{intl l='Cache'}{/block} - -{block name="check-resource"}admin.cache{/block} -{block name="check-access"}view{/block} - -{block name="main-content"} -
    - -
    - - - -
    -
    - {form name="thelia.cache.flush"} -
    - {form_hidden_fields form=$form} - -
    - {/form} -
    -
    -
    -
    -{/block} diff --git a/templates/backOffice/default/configuration.html b/templates/backOffice/default/configuration.html index e4d51dda8..c1fb66edd 100644 --- a/templates/backOffice/default/configuration.html +++ b/templates/backOffice/default/configuration.html @@ -1,201 +1,201 @@ -{extends file="admin-layout.tpl"} - -{block name="page-title"}{intl l='Configuration'}{/block} - -{block name="check-resource"}admin.configuration{/block} -{block name="check-access"}view{/block} - -{block name="main-content"} -
    - -
    - - {module_include location='configuration_top'} - -

    {intl l="Thelia configuration"}

    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - - {module_include location='configuration_bottom'} -
    -
    -
    -{/block} - -{block name="javascript-last-call"} - {module_include location='configuration-js'} +{extends file="admin-layout.tpl"} + +{block name="page-title"}{intl l='Configuration'}{/block} + +{block name="check-resource"}admin.configuration{/block} +{block name="check-access"}view{/block} + +{block name="main-content"} +
    + +
    + + {module_include location='configuration_top'} + +

    {intl l="Thelia configuration"}

    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + + {module_include location='configuration_bottom'} +
    +
    +
    +{/block} + +{block name="javascript-last-call"} + {module_include location='configuration-js'} {/block} \ No newline at end of file