From dbe641ad84895b5775a31a207312f425fd101e14 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Thu, 24 Apr 2014 14:28:52 +0200 Subject: [PATCH] create new resources --- .../Thelia/Config/Resources/routing/admin.xml | 10 +++++ .../Admin/ConfigurationController.php | 45 +++++++++++++++++++ .../Core/Security/Resource/AdminResources.php | 4 ++ setup/insert.sql | 8 +++- setup/update/2.0.1.sql | 21 +++++++++ templates/backOffice/default/I18n/fr_FR.php | 1 + templates/backOffice/default/admin-layout.tpl | 18 +++++--- 7 files changed, 101 insertions(+), 6 deletions(-) create mode 100644 core/lib/Thelia/Controller/Admin/ConfigurationController.php diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index 267bb2008..df2afbbcb 100644 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -549,6 +549,10 @@ + + Thelia\Controller\Admin\ConfigurationController::indexAction + + Thelia\Controller\Admin\ConfigController::defaultAction @@ -1150,6 +1154,12 @@ Thelia\Controller\Admin\TranslationsController::updateAction + + + + Thelia\Controller\Admin\ExportController::customerNewsletterAction + + diff --git a/core/lib/Thelia/Controller/Admin/ConfigurationController.php b/core/lib/Thelia/Controller/Admin/ConfigurationController.php new file mode 100644 index 000000000..9ca0ae627 --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/ConfigurationController.php @@ -0,0 +1,45 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Admin; + +use Thelia\Core\Security\AccessManager; +use Thelia\Core\Security\Resource\AdminResources; + + +/** + * Class ConfigurationController + * @package Thelia\Controller\Admin + * @author Manuel Raynaud + */ +class ConfigurationController extends BaseAdminController +{ + public function indexAction() + { + if (null !== $response = $this->checkAuth([AdminResources::CONFIG], [], [AccessManager::VIEW])) { + return $response; + } + + return $this->render('configuration'); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Security/Resource/AdminResources.php b/core/lib/Thelia/Core/Security/Resource/AdminResources.php index 5e78efd7e..dc44b8275 100644 --- a/core/lib/Thelia/Core/Security/Resource/AdminResources.php +++ b/core/lib/Thelia/Core/Security/Resource/AdminResources.php @@ -100,4 +100,8 @@ final class AdminResources const TRANSLATIONS = "admin.configuration.translations"; const UPDATE = "admin.configuration.update"; + + const EXPORT = "admin.export"; + + const TOOLS = "admin.tools"; } diff --git a/setup/insert.sql b/setup/insert.sql index f7c5a2db8..25e20b4d8 100644 --- a/setup/insert.sql +++ b/setup/insert.sql @@ -1277,7 +1277,9 @@ INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES (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()); +(32, 'admin.configuration.translations', NOW(), NOW()), +(33, 'admin.export', NOW(), NOW()), +(34, 'admin.tools', NOW(), NOW()); /** generated with command : php Thelia thelia:generate-resources --output sql-i18n @@ -1347,6 +1349,10 @@ INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES (31, 'fr_FR', 'Configuration avancée'), (32, 'en_US', 'Translations'), (32, 'fr_FR', 'Traductions'); +(33, 'en_US', 'Back-office export management'), +(33, 'fr_FR', 'gestion des exports'), +(34, 'en_US', 'Tools panel'), +(34, 'fr_FR', 'Outils'); 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 e1bf8e310..10e1dac06 100644 --- a/setup/update/2.0.1.sql +++ b/setup/update/2.0.1.sql @@ -12,6 +12,7 @@ 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()); @@ -48,6 +49,15 @@ INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES SET @max := @max+1; +INSERT INTO `resource` (`id`, `code`, `created_at`, `updated_at`) VALUES +(@max, 'admin.export', NOW(), NOW()); + +INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES +(@max, 'en_US', 'Back-office export management'), +(@max, 'fr_FR', 'gestion des exports'); + +SET @max := @max+1; + INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES (@max, 'admin.configuration.advanced', NOW(), NOW()); @@ -64,4 +74,15 @@ INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES (@max, 'en_US', 'Translations'), (@max, 'fr_FR', 'Traductions'); +SET @max := @max+1; + +INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES +(@max, 'admin.tools', NOW(), NOW()); + +INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES +(@max, 'en_US', 'Tools panel'), +(@max, 'fr_FR', 'Outils'); + + + SET FOREIGN_KEY_CHECKS = 1; diff --git a/templates/backOffice/default/I18n/fr_FR.php b/templates/backOffice/default/I18n/fr_FR.php index 812e7f221..478a22399 100755 --- a/templates/backOffice/default/I18n/fr_FR.php +++ b/templates/backOffice/default/I18n/fr_FR.php @@ -880,6 +880,7 @@ return array( 'To remove a value from the combination, select it and click "remove"' => 'Afin de supprimer une valeur de la combinaison, sélectionnez la et cliquez sur "Enlever"', 'To use features or attributes on this product, please select a product template. You can define product templates in the configuration section of the administration.' => 'Pour utiliser les déclinaisons et les caractéristiques sur ce produit, choisissez un tempplate produit. Vous pouvez gérer les templates de produit dans la section configuration de l\'administration.', 'Today' => 'Aujourd\'hui', + 'Tools' => 'Outils', 'Top level' => 'Niveau 1', 'Top level Contents' => 'Contenus de niveau 1', 'Top level Products' => 'Produits mis en avant', diff --git a/templates/backOffice/default/admin-layout.tpl b/templates/backOffice/default/admin-layout.tpl index 73bf88590..a36a3edc5 100644 --- a/templates/backOffice/default/admin-layout.tpl +++ b/templates/backOffice/default/admin-layout.tpl @@ -193,20 +193,28 @@ {/loop} + {loop name="menu-auth-tools" type="auth" role="ADMIN" resource="admin.tools" access="VIEW"} +
  • + {intl l="Tools"} +
  • + {/loop} + + {loop name="menu-auth-modules" type="auth" role="ADMIN" resource="admin.module" access="VIEW"} +
  • + {intl l="Modules"} +
  • + {/loop} + {loop name="menu-auth-config" type="auth" role="ADMIN" resource="admin.configuration" access="VIEW"}
  • {intl l="Configuration"}
  • {/loop} - {loop name="menu-auth-modules" type="auth" role="ADMIN" resource="admin.module" access="VIEW"} -
  • - {intl l="Modules"} -
  • {module_include location='in_top_menu_items'} - {/loop} + {loop name="top-bar-search" type="auth" role="ADMIN" resource="admin.search" access="VIEW"}