diff --git a/config/bundles.php b/config/bundles.php index 038f64d864..a6291ca356 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -7,4 +7,5 @@ Pimcore\Bundle\StaticRoutesBundle\PimcoreStaticRoutesBundle::class => ['all' => true], Pimcore\Bundle\NewsletterBundle\PimcoreNewsletterBundle::class => ['all' => true], Pimcore\Bundle\OpenSearchClientBundle\PimcoreOpenSearchClientBundle::class => ['all' => true], + CoreShop\Bundle\FrontendBundle\CoreShopFrontendBundle::class => ['all' => true], ]; diff --git a/src/CoreShop/Bundle/AddressBundle/DependencyInjection/Configuration.php b/src/CoreShop/Bundle/AddressBundle/DependencyInjection/Configuration.php index ed4ee5ee32..74491c9be0 100644 --- a/src/CoreShop/Bundle/AddressBundle/DependencyInjection/Configuration.php +++ b/src/CoreShop/Bundle/AddressBundle/DependencyInjection/Configuration.php @@ -278,7 +278,7 @@ private function addPimcoreResourcesSection(ArrayNodeDefinition $node): void ->end() ->scalarNode('permissions') ->cannotBeOverwritten() - ->defaultValue(['country', 'state', 'zone']) + ->defaultValue([]) ->end() ->end() ->end() diff --git a/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/country/item.js b/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/country/item.js index 9c6f5765a6..2402ccfb64 100644 --- a/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/country/item.js +++ b/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/country/item.js @@ -20,11 +20,7 @@ coreshop.country.item = Class.create(coreshop.resource.item, { save: 'coreshop_country_save' }, - getItems: function () { - return [this.getFormPanel()]; - }, - - getFormPanel: function () { + getFormPanelItems: function () { var data = this.data, langTabs = [], salutationsStore = Ext.create('Ext.data.ArrayStore', { @@ -104,35 +100,7 @@ coreshop.country.item = Class.create(coreshop.resource.item, { } ]; - this.formPanel = new Ext.form.Panel({ - bodyStyle: 'padding:20px 5px 20px 5px;', - border: false, - region: 'center', - autoScroll: true, - forceLayout: true, - defaults: { - forceLayout: true - }, - buttons: [ - { - text: t('save'), - handler: this.save.bind(this), - iconCls: 'pimcore_icon_apply' - } - ], - items: [ - { - xtype: 'fieldset', - autoHeight: true, - labelWidth: 350, - defaultType: 'textfield', - defaults: {width: 300}, - items: items - } - ] - }); - - return this.formPanel; + return items; }, getSaveData: function () { diff --git a/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/country/panel.js b/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/country/panel.js index 5713487094..07f1c314e7 100644 --- a/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/country/panel.js +++ b/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/country/panel.js @@ -21,6 +21,7 @@ coreshop.country.panel = Class.create(coreshop.resource.panel, { storeId: 'coreshop_countries', iconCls: 'coreshop_icon_country', type: 'coreshop_countries', + permission: 'coreshop_permission_country', routing: { add: 'coreshop_country_add', diff --git a/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/state/item.js b/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/state/item.js index 766268eda2..a6d2187a7d 100644 --- a/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/state/item.js +++ b/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/state/item.js @@ -20,11 +20,7 @@ coreshop.state.item = Class.create(coreshop.resource.item, { save: 'coreshop_state_save' }, - getItems: function () { - return [this.getFormPanel()]; - }, - - getFormPanel: function () { + getFormPanelItems: function () { var data = this.data, langTabs = []; @@ -45,62 +41,35 @@ coreshop.state.item = Class.create(coreshop.resource.item, { langTabs.push(tab); }); - this.formPanel = new Ext.form.Panel({ - bodyStyle: 'padding:20px 5px 20px 5px;', - border: false, - region: 'center', - autoScroll: true, - forceLayout: true, - defaults: { - forceLayout: true - }, - buttons: [ - { - text: t('save'), - handler: this.save.bind(this), - iconCls: 'pimcore_icon_apply' - } - ], - items: [ - { - xtype: 'fieldset', - autoHeight: true, - labelWidth: 350, - defaultType: 'textfield', - defaults: {width: 300}, - items: [ - { - xtype: 'tabpanel', - activeTab: 0, - defaults: { - autoHeight: true, - bodyStyle: 'padding:10px;' - }, - width: '100%', - items: langTabs - }, - { - fieldLabel: t('coreshop_state_isoCode'), - name: 'isoCode', - value: data.isoCode - }, - { - xtype: 'checkbox', - fieldLabel: t('active'), - name: 'active', - checked: data.active - }, - { - xtype: 'coreshop.country', - value: data.country, - name: 'country' - } - ] - } - ] - }); - return this.formPanel; + return [ + { + xtype: 'tabpanel', + activeTab: 0, + defaults: { + autoHeight: true, + bodyStyle: 'padding:10px;' + }, + width: '100%', + items: langTabs + }, + { + fieldLabel: t('coreshop_state_isoCode'), + name: 'isoCode', + value: data.isoCode + }, + { + xtype: 'checkbox', + fieldLabel: t('active'), + name: 'active', + checked: data.active + }, + { + xtype: 'coreshop.country', + value: data.country, + name: 'country' + } + ]; }, getSaveData: function () { diff --git a/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/state/panel.js b/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/state/panel.js index f579b7c720..d788767cbe 100644 --- a/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/state/panel.js +++ b/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/state/panel.js @@ -21,6 +21,7 @@ coreshop.state.panel = Class.create(coreshop.resource.panel, { storeId: 'coreshop_states', iconCls: 'coreshop_icon_state', type: 'coreshop_states', + permission: 'coreshop_permission_state', routing: { add: 'coreshop_state_add', diff --git a/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/zone/item.js b/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/zone/item.js index fef9b3a9aa..534918a63e 100644 --- a/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/zone/item.js +++ b/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/zone/item.js @@ -20,53 +20,20 @@ coreshop.zone.item = Class.create(coreshop.resource.item, { save: 'coreshop_zone_save' }, - getItems: function () { - return [this.getFormPanel()]; - }, - - getFormPanel: function () { - - this.formPanel = new Ext.form.Panel({ - bodyStyle: 'padding:20px 5px 20px 5px;', - border: false, - region: 'center', - autoScroll: true, - forceLayout: true, - defaults: { - forceLayout: true + getFormPanelItems: function () { + return [ + { + fieldLabel: t('name'), + name: 'name', + value: this.data.name }, - buttons: [ - { - text: t('save'), - handler: this.save.bind(this), - iconCls: 'pimcore_icon_apply' - } - ], - items: [ - { - xtype: 'fieldset', - autoHeight: true, - labelWidth: 250, - defaultType: 'textfield', - defaults: {width: 300}, - items: [ - { - fieldLabel: t('name'), - name: 'name', - value: this.data.name - }, - { - xtype: 'checkbox', - fieldLabel: t('active'), - name: 'active', - checked: this.data.active - } - ] - } - ] - }); - - return this.formPanel; + { + xtype: 'checkbox', + fieldLabel: t('active'), + name: 'active', + checked: this.data.active + } + ]; }, getSaveData: function () { diff --git a/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/zone/panel.js b/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/zone/panel.js index ca3f2f5893..76b741edd6 100644 --- a/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/zone/panel.js +++ b/src/CoreShop/Bundle/AddressBundle/Resources/public/pimcore/js/zone/panel.js @@ -21,6 +21,7 @@ coreshop.zone.panel = Class.create(coreshop.resource.panel, { storeId: 'coreshop_zones', iconCls: 'coreshop_icon_zone', type: 'coreshop_zones', + permission: 'coreshop_permission_zone', routing: { add: 'coreshop_zone_add', diff --git a/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.de.yml b/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.de.yml index 355fcfef37..231ab1b0a3 100644 --- a/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.de.yml +++ b/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.de.yml @@ -9,9 +9,21 @@ coreshop_state_isoCode: 'ISO' coreshop_state_country: 'Land' coreshop_country_addressFormat: 'Adressformatierung' coreshop_country_salutations: 'Anreden' -coreshop_permission_country: 'CoreShop: Land' -coreshop_permission_state: 'CoreShop: Staat' -coreshop_permission_zone: 'CoreShop: Zone' +coreshop_permission_country_list: 'CoreShop: Länder Liste' +coreshop_permission_country_create: 'CoreShop: Land erstellen' +coreshop_permission_country_edit: 'CoreShop: Land bearbeiten' +coreshop_permission_country_delete: 'CoreShop: Land löschen' +coreshop_permission_country_view: 'CoreShop: Land ansehen' +coreshop_permission_state_list: 'CoreShop: Staaten Liste' +coreshop_permission_state_create: 'CoreShop: Staat erstellen' +coreshop_permission_state_edit: 'CoreShop: Staat bearbeiten' +coreshop_permission_state_delete: 'CoreShop: Staat löschen' +coreshop_permission_state_view: 'CoreShop: Staat ansehen' +coreshop_permission_zone_list: 'CoreShop: Zonen Liste' +coreshop_permission_zone_create: 'CoreShop: Zone erstellen' +coreshop_permission_zone_edit: 'CoreShop: Zone bearbeiten' +coreshop_permission_zone_delete: 'CoreShop: Zone löschen' +coreshop_permission_zone_view: 'CoreShop: Zone ansehen' coreshop_address_company: 'Unternehmen' coreshop_address_firstname: 'Vorname' coreshop_address_lastname: 'Nachname' diff --git a/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.en.yml b/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.en.yml index 6b8cdce630..65fbf0b50a 100644 --- a/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.en.yml +++ b/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.en.yml @@ -8,9 +8,21 @@ coreshop_state_isoCode: 'ISO Code' coreshop_state_country: 'Country' coreshop_country_addressFormat: 'Address Format' coreshop_country_salutations: 'Salutations' -coreshop_permission_country: 'CoreShop: Country' -coreshop_permission_state: 'CoreShop: State' -coreshop_permission_zone: 'CoreShop: Zone' +coreshop_permission_country_list: 'CoreShop Country: List' +coreshop_permission_country_create: 'CoreShop Country: Create' +coreshop_permission_country_edit: 'CoreShop : Edit' +coreshop_permission_country_delete: 'CoreShop Country: Delete' +coreshop_permission_country_view: 'CoreShop Country: View' +coreshop_permission_state_list: 'CoreShop State: List' +coreshop_permission_state_create: 'CoreShop State: Create' +coreshop_permission_state_edit: 'CoreShop State: Edit' +coreshop_permission_state_delete: 'CoreShop State: Delete' +coreshop_permission_state_view: 'CoreShop State: View' +coreshop_permission_zone_list: 'CoreShop: Zone List' +coreshop_permission_zone_create: 'CoreShop Zone: Create' +coreshop_permission_zone_edit: 'CoreShop Zone: Edit' +coreshop_permission_zone_delete: 'CoreShop Zone: Delete' +coreshop_permission_zone_view: 'CoreShop Zone: View' coreshop_address_company: 'Company' coreshop_address_firstname: 'Firstname' coreshop_address_lastname: 'Lastname' diff --git a/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.it.yml b/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.it.yml index 7c3744a854..44e614730a 100644 --- a/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.it.yml +++ b/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.it.yml @@ -8,8 +8,6 @@ coreshop_state_isoCode: 'Codice ISO' coreshop_state_country: 'Paese' coreshop_country_addressFormat: 'Formato indirizzo' coreshop_country_salutations: 'Titoli' -coreshop_permission_country: 'CoreShop: Paese' -coreshop_permission_zone: 'CoreShop: Zona' coreshop_address_company: 'Azienda' coreshop_address_firstname: 'Nome' coreshop_address_lastname: 'Cognome' diff --git a/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.pl.yml b/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.pl.yml index b6c10a9e64..7e55eb9234 100644 --- a/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.pl.yml +++ b/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.pl.yml @@ -8,9 +8,6 @@ coreshop_state_isoCode: 'Kod ISO' coreshop_state_country: 'Kraj' coreshop_country_addressFormat: 'Format adresu' coreshop_country_salutations: 'Zwroty grzecznościowe' -coreshop_permission_country: 'CoreShop: Kraj' -coreshop_permission_state: 'CoreShop: Stan' -coreshop_permission_zone: 'CoreShop: Strefa' coreshop_address_company: 'Firma' coreshop_address_firstname: 'Imię' coreshop_address_lastname: 'Nazwisko' diff --git a/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.sv.yml b/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.sv.yml index c1eda43c73..bb5fb6abc0 100644 --- a/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.sv.yml +++ b/src/CoreShop/Bundle/AddressBundle/Resources/translations/admin.sv.yml @@ -9,9 +9,6 @@ coreshop_state_isoCode: 'ISO-kod' coreshop_state_country: 'Land' coreshop_country_addressFormat: 'Adressformat' coreshop_country_salutations: 'Hälsningsfras' -coreshop_permission_country: 'CoreShop: Land' -coreshop_permission_state: 'CoreShop: Delstat' -coreshop_permission_zone: 'CoreShop: Zon' coreshop_address_company: 'Företag' coreshop_address_firstname: 'Förnamn' coreshop_address_lastname: 'Efternamn' diff --git a/src/CoreShop/Bundle/CoreBundle/Menu/MainMenuBuilder.php b/src/CoreShop/Bundle/CoreBundle/Menu/MainMenuBuilder.php index 5f42f83f7c..90ecc8b1c2 100644 --- a/src/CoreShop/Bundle/CoreBundle/Menu/MainMenuBuilder.php +++ b/src/CoreShop/Bundle/CoreBundle/Menu/MainMenuBuilder.php @@ -76,7 +76,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $priceRules ->addChild('coreshop_cart_pricerules') ->setLabel('coreshop_cart_pricerules') - ->setAttribute('permission', 'coreshop_permission_cart_price_rule') + ->setAttribute('permission', 'coreshop_permission_cart_price_rule_list') ->setAttribute('iconCls', 'coreshop_nav_icon_price_rule') ->setAttribute('resource', 'coreshop.order') ->setAttribute('function', 'cart_price_rule') @@ -86,7 +86,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $priceRules ->addChild('coreshop_product_pricerules') ->setLabel('coreshop_product_pricerules') - ->setAttribute('permission', 'coreshop_permission_product_price_rule') + ->setAttribute('permission', 'coreshop_permission_product_price_rule_list') ->setAttribute('iconCls', 'coreshop_nav_icon_price_rule') ->setAttribute('resource', 'coreshop.product') ->setAttribute('function', 'product_price_rule') @@ -104,7 +104,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $localization ->addChild('coreshop_countries') ->setLabel('coreshop_countries') - ->setAttribute('permission', 'coreshop_permission_country') + ->setAttribute('permission', 'coreshop_permission_country_list') ->setAttribute('iconCls', 'coreshop_nav_icon_country') ->setAttribute('resource', 'coreshop.address') ->setAttribute('function', 'country') @@ -114,7 +114,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $localization ->addChild('coreshop_states') ->setLabel('coreshop_states') - ->setAttribute('permission', 'coreshop_permission_state') + ->setAttribute('permission', 'coreshop_permission_state_list') ->setAttribute('iconCls', 'coreshop_nav_icon_state') ->setAttribute('resource', 'coreshop.address') ->setAttribute('function', 'state') @@ -124,7 +124,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $localization ->addChild('coreshop_currencies') ->setLabel('coreshop_currencies') - ->setAttribute('permission', 'coreshop_permission_currency') + ->setAttribute('permission', 'coreshop_permission_currency_list') ->setAttribute('iconCls', 'coreshop_nav_icon_currency') ->setAttribute('resource', 'coreshop.currency') ->setAttribute('function', 'currency') @@ -134,7 +134,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $localization ->addChild('coreshop_exchange_rates') ->setLabel('coreshop_exchange_rates') - ->setAttribute('permission', 'coreshop_permission_exchange_rate') + ->setAttribute('permission', 'coreshop_permission_exchange_rate_list') ->setAttribute('iconCls', 'coreshop_nav_icon_exchange_rate') ->setAttribute('resource', 'coreshop.currency') ->setAttribute('function', 'exchange_rate') @@ -144,7 +144,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $localization ->addChild('coreshop_zones') ->setLabel('coreshop_zones') - ->setAttribute('permission', 'coreshop_permission_zone') + ->setAttribute('permission', 'coreshop_permission_zone_list') ->setAttribute('iconCls', 'coreshop_nav_icon_zone') ->setAttribute('resource', 'coreshop.address') ->setAttribute('function', 'zone') @@ -154,7 +154,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $localization ->addChild('coreshop_taxes') ->setLabel('coreshop_taxes') - ->setAttribute('permission', 'coreshop_permission_tax_rate') + ->setAttribute('permission', 'coreshop_permission_tax_rate_list') ->setAttribute('iconCls', 'coreshop_nav_icon_taxes') ->setAttribute('resource', 'coreshop.taxation') ->setAttribute('function', 'tax_item') @@ -164,7 +164,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $localization ->addChild('coreshop_taxrulegroups') ->setLabel('coreshop_taxrulegroups') - ->setAttribute('permission', 'coreshop_permission_tax_rule_group') + ->setAttribute('permission', 'coreshop_permission_tax_rule_group_list') ->setAttribute('iconCls', 'coreshop_nav_icon_tax_rule_groups') ->setAttribute('resource', 'coreshop.taxation') ->setAttribute('function', 'tax_rule_group') @@ -250,7 +250,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $carriersMenu ->addChild('coreshop_carriers') ->setLabel('coreshop_carriers') - ->setAttribute('permission', 'coreshop_permission_carrier') + ->setAttribute('permission', 'coreshop_permission_carrier_list') ->setAttribute('iconCls', 'coreshop_nav_icon_carriers') ->setAttribute('resource', 'coreshop.shipping') ->setAttribute('function', 'carrier') @@ -260,7 +260,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $carriersMenu ->addChild('coreshop_carriers_shipping_rules') ->setLabel('coreshop_carriers_shipping_rules') - ->setAttribute('permission', 'coreshop_permission_shipping_rule') + ->setAttribute('permission', 'coreshop_permission_shipping_rule_list') ->setAttribute('iconCls', 'coreshop_nav_icon_carrier_shipping_rule') ->setAttribute('resource', 'coreshop.shipping') ->setAttribute('function', 'shipping_rules') @@ -278,7 +278,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $productsMenu ->addChild('coreshop_indexes') ->setLabel('coreshop_indexes') - ->setAttribute('permission', 'coreshop_permission_index') + ->setAttribute('permission', 'coreshop_permission_index_list') ->setAttribute('iconCls', 'coreshop_nav_icon_indexes') ->setAttribute('resource', 'coreshop.index') ->setAttribute('function', 'index') @@ -288,7 +288,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $productsMenu ->addChild('coreshop_product_units') ->setLabel('coreshop_product_units') - ->setAttribute('permission', 'coreshop_permission_product_unit') + ->setAttribute('permission', 'coreshop_permission_product_unit_list') ->setAttribute('iconCls', 'coreshop_nav_icon_product_units') ->setAttribute('resource', 'coreshop.product') ->setAttribute('function', 'product_unit') @@ -298,7 +298,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $productsMenu ->addChild('coreshop_filters') ->setLabel('coreshop_filters') - ->setAttribute('permission', 'coreshop_permission_filter') + ->setAttribute('permission', 'coreshop_permission_filter_list') ->setAttribute('iconCls', 'coreshop_nav_icon_filters') ->setAttribute('resource', 'coreshop.index') ->setAttribute('function', 'filter') @@ -355,7 +355,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $menuItem->addChild('coreshop_notification_rules') ->setLabel('coreshop_notification_rules') - ->setAttribute('permission', 'coreshop_permission_notification') + ->setAttribute('permission', 'coreshop_permission_notification_list') ->setAttribute('iconCls', 'coreshop_nav_icon_notification_rule') ->setAttribute('resource', 'coreshop.notification') ->setAttribute('function', 'notification_rule') @@ -373,7 +373,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $paymentMenu ->addChild('coreshop_payment_providers') ->setLabel('coreshop_payment_providers') - ->setAttribute('permission', 'coreshop_permission_payment_provider') + ->setAttribute('permission', 'coreshop_permission_payment_provider_list') ->setAttribute('iconCls', 'coreshop_nav_icon_payment_provider') ->setAttribute('resource', 'coreshop.payment') ->setAttribute('function', 'payment_provider') @@ -383,7 +383,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $paymentMenu ->addChild('coreshop_payment_provider_rule') ->setLabel('coreshop_payment_provider_rule') - ->setAttribute('permission', 'coreshop_permission_payment_provider_rule') + ->setAttribute('permission', 'coreshop_permission_payment_provider_rule_list') ->setAttribute('iconCls', 'coreshop_nav_icon_payment_provider_rule') ->setAttribute('resource', 'coreshop.payment') ->setAttribute('function', 'payment_provider_rule') @@ -392,7 +392,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $menuItem->addChild('coreshop_stores') ->setLabel('coreshop_stores') - ->setAttribute('permission', 'coreshop_permission_store') + ->setAttribute('permission', 'coreshop_permission_store_list') ->setAttribute('iconCls', 'coreshop_nav_icon_store') ->setAttribute('resource', 'coreshop.store') ->setAttribute('function', 'store') diff --git a/src/CoreShop/Bundle/CoreBundle/Migrations/Version20250731125544.php b/src/CoreShop/Bundle/CoreBundle/Migrations/Version20250731125544.php new file mode 100644 index 0000000000..45abe15003 --- /dev/null +++ b/src/CoreShop/Bundle/CoreBundle/Migrations/Version20250731125544.php @@ -0,0 +1,105 @@ +addSql('INSERT INTO users_permission_definitions (`key`, `category`) VALUES (?, ?)', [ + $subPermissionKey, + sprintf('coreshop_permission_group_%s', 'coreshop'), + ]); + } + } + } + + $users = new \Pimcore\Model\User\Listing(); + $users = $users->getUsers(); + + foreach ($users as $user) { + $newUserPermissions = []; + $changed = false; + + foreach ($user->getPermissions() as $permission) { + if (!in_array($permission, $permissions)) { + $newUserPermissions[] = $permission; + + continue; + } + + foreach (ResourcePermission::getAllPermissions() as $resourcePermission) { + $changed = true; + $newUserPermissions[] = sprintf('%s_%s', $permission, $resourcePermission); + } + } + + if ($changed) { + $user->setPermissions($newUserPermissions); + $user->save(); + } + } + + foreach ($permissions as $permissionKey) { + $this->addSql('DELETE FROM users_permission_definitions WHERE `key` = ?', [$permissionKey]); + } + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + } +} diff --git a/src/CoreShop/Bundle/CoreBundle/Resources/public/pimcore/js/address/country/item.js b/src/CoreShop/Bundle/CoreBundle/Resources/public/pimcore/js/address/country/item.js index 993e4d9c96..ed10383451 100644 --- a/src/CoreShop/Bundle/CoreBundle/Resources/public/pimcore/js/address/country/item.js +++ b/src/CoreShop/Bundle/CoreBundle/Resources/public/pimcore/js/address/country/item.js @@ -16,13 +16,16 @@ coreshop.country.item = Class.create(coreshop.country.item, { var panel = $super(), data = this.data; - panel.down("fieldset").add([ + panel.add([ { xtype: 'coreshop.currency', value: data.currency } ]); + panel.setDisabled(false); + panel.setDisabled(!this.isAllowed('edit')); + this.formPanel = panel; return this.formPanel; diff --git a/src/CoreShop/Bundle/CoreBundle/Resources/public/pimcore/js/payment/provider/item.js b/src/CoreShop/Bundle/CoreBundle/Resources/public/pimcore/js/payment/provider/item.js index 75a450da10..1410442467 100644 --- a/src/CoreShop/Bundle/CoreBundle/Resources/public/pimcore/js/payment/provider/item.js +++ b/src/CoreShop/Bundle/CoreBundle/Resources/public/pimcore/js/payment/provider/item.js @@ -16,7 +16,7 @@ coreshop.provider.item = Class.create(coreshop.provider.item, { var panel = $super(), data = this.data; - panel.down("fieldset").add([ + panel.add([ { xtype: 'coreshop.store', name: 'stores', @@ -26,6 +26,9 @@ coreshop.provider.item = Class.create(coreshop.provider.item, { } ]); + panel.setDisabled(false); + panel.setDisabled(!this.isAllowed('edit')); + this.formPanel = panel; return this.formPanel; diff --git a/src/CoreShop/Bundle/CoreBundle/Resources/public/pimcore/js/shipping/carrier/item.js b/src/CoreShop/Bundle/CoreBundle/Resources/public/pimcore/js/shipping/carrier/item.js index d172fa8b4e..f0df786aee 100644 --- a/src/CoreShop/Bundle/CoreBundle/Resources/public/pimcore/js/shipping/carrier/item.js +++ b/src/CoreShop/Bundle/CoreBundle/Resources/public/pimcore/js/shipping/carrier/item.js @@ -16,7 +16,7 @@ coreshop.carrier.item = Class.create(coreshop.carrier.item, { var panel = $super(), data = this.data; - panel.down("fieldset").add([ + panel.down("form").add([ { xtype: 'coreshop.store', name: 'stores', @@ -30,8 +30,9 @@ coreshop.carrier.item = Class.create(coreshop.carrier.item, { } ]); - this.formPanel = panel; + panel.down("form").setDisabled(false); + panel.down("form").setDisabled(!this.isAllowed('edit')); - return this.formPanel; + return panel; } }); diff --git a/src/CoreShop/Bundle/CoreBundle/Resources/public/pimcore/js/store/item.js b/src/CoreShop/Bundle/CoreBundle/Resources/public/pimcore/js/store/item.js index d2a6341545..e45998852d 100644 --- a/src/CoreShop/Bundle/CoreBundle/Resources/public/pimcore/js/store/item.js +++ b/src/CoreShop/Bundle/CoreBundle/Resources/public/pimcore/js/store/item.js @@ -69,6 +69,9 @@ coreshop.store.item = Class.create(coreshop.store.item, { } ] ); + + panel.setDisabled(false); + panel.setDisabled(!this.isAllowed('edit')); return this.formPanel; } diff --git a/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.de.yml b/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.de.yml index 44640cd0a0..8d09764c58 100644 --- a/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.de.yml +++ b/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.de.yml @@ -176,7 +176,11 @@ coreshop_message_type_contact: 'Kontakt' coreshop_grid_reorder: 'Drag and drop um die Sortierung zu ändern' coreshop_payment_partial: 'Teilzahlung gemacht' coreshop_payment_full: 'Gesamtzahlung gemacht' -coreshop_permission_notification: 'CoreShop: Benachrichtigung' +coreshop_permission_notification_list: 'CoreShop: Benachrichtigungen Liste' +coreshop_permission_notification_create: 'CoreShop: Benachrichtigung erstellen' +coreshop_permission_notification_edit: 'CoreShop: Benachrichtigung bearbeiten' +coreshop_permission_notification_delete: 'CoreShop: Benachrichtigung löschen' +coreshop_permission_notification_view: 'CoreShop: Benachrichtigung ansehen' coreshop_permission_settings: 'CoreShop: Einstellungen' coreshop_condition_saleState: 'Typ Status' coreshop_condition_orderState: 'Status' @@ -247,4 +251,4 @@ coreshop_customer_transformer_assignment_form_new_company_title: 'Neue Unternehm coreshop_customer_transformer_assignment_new_form_button: 'Firma erstellen und Kunden zuweisen' coreshop_customer_transformer_assignment_new_form_description: 'Nach Absenden dieses Formulars wird ein neues Unternehmen erstellt. Bitte überprüfen Sie die Daten sorgfältig. Darüber hinaus müssen Sie festlegen, ob die Kundenadressen vom Kunden gespeichert oder an das neue Unternehmen übertragen werden sollen.' coreshop_customer_transformer_assignment_new_form_maybe_duplicates_title: 'Ähnliche Unternehmen' -coreshop.wishlist.name: 'Name' +coreshop.wishlist.name: 'Name' \ No newline at end of file diff --git a/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.en.yml b/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.en.yml index 5eac58b2e0..5ee3fee6e0 100644 --- a/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.en.yml +++ b/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.en.yml @@ -175,7 +175,11 @@ coreshop_message_type_contact: 'Contact' coreshop_grid_reorder: 'Drag and drop to reorganize' coreshop_payment_partial: 'Partial Payment done' coreshop_payment_full: 'Full Payment done' -coreshop_permission_notification: 'CoreShop: Notification' +coreshop_permission_notification_list: 'CoreShop Notification: List' +coreshop_permission_notification_create: 'CoreShop Notification: Create' +coreshop_permission_notification_edit: 'CoreShop Notification: Edit' +coreshop_permission_notification_delete: 'CoreShop Notification: Delete' +coreshop_permission_notification_view: 'CoreShop Notification: View' coreshop_permission_settings: 'CoreShop: Settings' coreshop_condition_saleState: 'Type State' coreshop_condition_orderState: 'Order State' @@ -247,4 +251,4 @@ coreshop_customer_transformer_assignment_form_new_company_title: 'New Company Da coreshop_customer_transformer_assignment_new_form_button: 'Create Company and assign Customer' coreshop_customer_transformer_assignment_new_form_description: 'Once this form is submitted, a new company will be created. Please check the data carefully. In addition, you must define whether the customer addresses are to be retained by the customer or transferred to the new company.' coreshop_customer_transformer_assignment_new_form_maybe_duplicates_title: 'Similar Companies' -coreshop.wishlist.name: 'Name' +coreshop.wishlist.name: 'Name' \ No newline at end of file diff --git a/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.it.yml b/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.it.yml index 5c30354f2f..4b39e6be6c 100644 --- a/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.it.yml +++ b/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.it.yml @@ -147,7 +147,6 @@ coreshop_message_type_contact: 'Contatto' coreshop_grid_reorder: 'Trascina per riorganizzare' coreshop_payment_partial: 'Pagamento parziale eseguito' coreshop_payment_full: 'Pagamento completo eseguito' -coreshop_permission_notification: 'CoreShop: Notifica' coreshop_condition_orderState: 'Stato dell''ordine' coreshop_condition_orderTransition: 'Transizione dell''ordine' coreshop_mail_rule_send_invoices: 'Invia fatture' diff --git a/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.sv.yml b/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.sv.yml index ee21f10087..d93153dc7b 100644 --- a/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.sv.yml +++ b/src/CoreShop/Bundle/CoreBundle/Resources/translations/admin.sv.yml @@ -144,6 +144,5 @@ coreshop_message_type_customer: 'Kund' coreshop_message_type_customer_reply: 'Kundsvar' coreshop_message_type_contact: 'Kontakt' coreshop_grid_reorder: 'Dra och släpp för att omorganisera' -coreshop_permission_notification: 'CoreShop: Notifikation' coreshop_action_mail: 'E-post' coreshop_allowed_countries: 'Tillåta Länder' diff --git a/src/CoreShop/Bundle/CurrencyBundle/DependencyInjection/Configuration.php b/src/CoreShop/Bundle/CurrencyBundle/DependencyInjection/Configuration.php index 72782301ee..d057a965aa 100644 --- a/src/CoreShop/Bundle/CurrencyBundle/DependencyInjection/Configuration.php +++ b/src/CoreShop/Bundle/CurrencyBundle/DependencyInjection/Configuration.php @@ -132,7 +132,7 @@ private function addPimcoreResourcesSection(ArrayNodeDefinition $node): void ->end() ->scalarNode('permissions') ->cannotBeOverwritten() - ->defaultValue(['currency', 'exchange_rate']) + ->defaultValue([]) ->end() ->end() ->end() diff --git a/src/CoreShop/Bundle/CurrencyBundle/Resources/public/pimcore/js/currency/item.js b/src/CoreShop/Bundle/CurrencyBundle/Resources/public/pimcore/js/currency/item.js index c11c4adef0..9cb8887381 100644 --- a/src/CoreShop/Bundle/CurrencyBundle/Resources/public/pimcore/js/currency/item.js +++ b/src/CoreShop/Bundle/CurrencyBundle/Resources/public/pimcore/js/currency/item.js @@ -20,62 +20,30 @@ coreshop.currency.item = Class.create(coreshop.resource.item, { save: 'coreshop_currency_save' }, - getItems: function () { - return [this.getFormPanel()]; - }, - - getFormPanel: function () { - this.formPanel = new Ext.form.Panel({ - bodyStyle: 'padding:20px 5px 20px 5px;', - border: false, - region: 'center', - autoScroll: true, - forceLayout: true, - defaults: { - forceLayout: true + getFormPanelItems: function () { + return [ + { + fieldLabel: t('name'), + name: 'name', + value: this.data.name }, - buttons: [ - { - text: t('save'), - handler: this.save.bind(this), - iconCls: 'pimcore_icon_apply' - } - ], - items: [ - { - xtype: 'fieldset', - autoHeight: true, - labelWidth: 250, - defaultType: 'textfield', - defaults: {width: 300}, - items: [ - { - fieldLabel: t('name'), - name: 'name', - value: this.data.name - }, - { - fieldLabel: t('coreshop_currency_isoCode'), - name: 'isoCode', - value: this.data.isoCode - }, - { - xtype: 'numberfield', - fieldLabel: t('coreshop_currency_numericIsoCode'), - name: 'numericIsoCode', - value: this.data.numericIsoCode - }, - { - fieldLabel: t('coreshop_currency_symbol'), - name: 'symbol', - value: this.data.symbol - } - ] - } - ] - }); - - return this.formPanel; + { + fieldLabel: t('coreshop_currency_isoCode'), + name: 'isoCode', + value: this.data.isoCode + }, + { + xtype: 'numberfield', + fieldLabel: t('coreshop_currency_numericIsoCode'), + name: 'numericIsoCode', + value: this.data.numericIsoCode + }, + { + fieldLabel: t('coreshop_currency_symbol'), + name: 'symbol', + value: this.data.symbol + } + ]; }, getSaveData: function () { diff --git a/src/CoreShop/Bundle/CurrencyBundle/Resources/public/pimcore/js/currency/panel.js b/src/CoreShop/Bundle/CurrencyBundle/Resources/public/pimcore/js/currency/panel.js index f40fce4019..818ab49afd 100644 --- a/src/CoreShop/Bundle/CurrencyBundle/Resources/public/pimcore/js/currency/panel.js +++ b/src/CoreShop/Bundle/CurrencyBundle/Resources/public/pimcore/js/currency/panel.js @@ -21,6 +21,7 @@ coreshop.currency.panel = Class.create(coreshop.resource.panel, { storeId: 'coreshop_currencies', iconCls: 'coreshop_icon_currency', type: 'coreshop_currencies', + permission: 'coreshop_permission_currency', routing: { add: 'coreshop_currency_add', diff --git a/src/CoreShop/Bundle/CurrencyBundle/Resources/public/pimcore/js/exchangeRate/panel.js b/src/CoreShop/Bundle/CurrencyBundle/Resources/public/pimcore/js/exchangeRate/panel.js index 3195c31fd2..5988e745b6 100644 --- a/src/CoreShop/Bundle/CurrencyBundle/Resources/public/pimcore/js/exchangeRate/panel.js +++ b/src/CoreShop/Bundle/CurrencyBundle/Resources/public/pimcore/js/exchangeRate/panel.js @@ -21,6 +21,7 @@ coreshop.exchange_rate.panel = Class.create(coreshop.resource.panel, { storeId: 'coreshop_exchange_rates', iconCls: 'coreshop_icon_exchange_rate', type: 'coreshop_exchange_rate', + permission: 'coreshop_permission_exchange_rate', routing: { add: 'coreshop_exchange_rate_add', @@ -43,6 +44,7 @@ coreshop.exchange_rate.panel = Class.create(coreshop.resource.panel, { this.grid = Ext.create('Ext.grid.Panel', { store: pimcore.globalmanager.get(this.storeId), region: 'center', + disabled: !this.isAllowed('edit'), columns: [ { header: t('coreshop_from_currency'), diff --git a/src/CoreShop/Bundle/CurrencyBundle/Resources/translations/admin.de.yml b/src/CoreShop/Bundle/CurrencyBundle/Resources/translations/admin.de.yml index b0e8f27324..a6a2ea6121 100644 --- a/src/CoreShop/Bundle/CurrencyBundle/Resources/translations/admin.de.yml +++ b/src/CoreShop/Bundle/CurrencyBundle/Resources/translations/admin.de.yml @@ -8,7 +8,15 @@ coreshop_from_currency: 'Von Währung' coreshop_to_currency: 'Zu Währung' coreshop_exchange_rate: 'Wechselkurs' coreshop_exchange_rates: 'Wechselkurse' -coreshop_permission_currency: 'CoreShop: Währung' -coreshop_permission_exchange_rate: 'CoreShop: Wechselkurs' +coreshop_permission_currency_list: 'CoreShop: Währungs Liste' +coreshop_permission_currency_create: 'CoreShop: Währung erstellen' +coreshop_permission_currency_edit: 'CoreShop: Währung bearbeiten' +coreshop_permission_currency_delete: 'CoreShop: Währung löschen' +coreshop_permission_currency_view: 'CoreShop: Währung ansehen' +coreshop_permission_exchange_rate_list: 'CoreShop: Wechselkurs Liste' +coreshop_permission_exchange_rate_create: 'CoreShop: Wechselkurs erstellen' +coreshop_permission_exchange_rate_edit: 'CoreShop: Wechselkurs bearbeiten' +coreshop_permission_exchange_rate_delete: 'CoreShop: Wechselkurs löschen' +coreshop_permission_exchange_rate_view: 'CoreShop: Wechselkurs ansehen' coreshop_money_currency: 'Geld/Währung' coreshop_currencies: 'Währungen' diff --git a/src/CoreShop/Bundle/CurrencyBundle/Resources/translations/admin.en.yml b/src/CoreShop/Bundle/CurrencyBundle/Resources/translations/admin.en.yml index 91167acd64..e6e2cbb7cf 100644 --- a/src/CoreShop/Bundle/CurrencyBundle/Resources/translations/admin.en.yml +++ b/src/CoreShop/Bundle/CurrencyBundle/Resources/translations/admin.en.yml @@ -7,7 +7,15 @@ coreshop_from_currency: 'From Currency' coreshop_to_currency: 'To Currency' coreshop_exchange_rate: 'Exchange Rate' coreshop_exchange_rates: 'Exchange Rates' -coreshop_permission_currency: 'CoreShop: Currency' -coreshop_permission_exchange_rate: 'CoreShop: Exchange Rate' +coreshop_permission_currency_list: 'CoreShop Currency: List' +coreshop_permission_currency_create: 'CoreShop Currency: Create' +coreshop_permission_currency_edit: 'CoreShop Currency: Edit' +coreshop_permission_currency_delete: 'CoreShop Currency: Delete' +coreshop_permission_currency_view: 'CoreShop Currency: View' +coreshop_permission_exchange_rate_list: 'CoreShop Exchange Rate: List' +coreshop_permission_exchange_rate_create: 'CoreShop Exchange Rate: Create' +coreshop_permission_exchange_rate_edit: 'CoreShop Exchange Rate: Edit' +coreshop_permission_exchange_rate_delete: 'CoreShop Exchange Rate: Delete' +coreshop_permission_exchange_rate_view: 'CoreShop Exchange Rate: View' coreshop_money_currency: 'Money Currency' coreshop_currencies: 'Currencies' diff --git a/src/CoreShop/Bundle/CurrencyBundle/Resources/translations/admin.sv.yml b/src/CoreShop/Bundle/CurrencyBundle/Resources/translations/admin.sv.yml index 98ffed1977..dd77dd3343 100644 --- a/src/CoreShop/Bundle/CurrencyBundle/Resources/translations/admin.sv.yml +++ b/src/CoreShop/Bundle/CurrencyBundle/Resources/translations/admin.sv.yml @@ -5,6 +5,4 @@ coreshop_from_currency: 'Från valuta' coreshop_to_currency: 'Till valuta' coreshop_exchange_rate: 'Växelkurs' coreshop_exchange_rates: 'Växelkurser' -coreshop_permission_currency: 'CoreShop: Valuta' -coreshop_permission_exchange_rate: 'CoreShop: Växelkurs' coreshop_currencies: 'Valutor' diff --git a/src/CoreShop/Bundle/FrontendBundle/Controller/CheckoutController.php b/src/CoreShop/Bundle/FrontendBundle/Controller/CheckoutController.php index 39dd847b3a..b493a51c59 100644 --- a/src/CoreShop/Bundle/FrontendBundle/Controller/CheckoutController.php +++ b/src/CoreShop/Bundle/FrontendBundle/Controller/CheckoutController.php @@ -32,7 +32,6 @@ use CoreShop\Component\Order\OrderSaleTransitions; use CoreShop\Component\Order\OrderTransitions; use CoreShop\Component\Order\Repository\OrderRepositoryInterface; -use CoreShop\Component\Resource\TokenGenerator\UniqueTokenGenerator; use CoreShop\Component\Tracking\Tracker\TrackerInterface; use Payum\Core\Payum; use Symfony\Component\HttpFoundation\Request; diff --git a/src/CoreShop/Bundle/IndexBundle/DependencyInjection/Configuration.php b/src/CoreShop/Bundle/IndexBundle/DependencyInjection/Configuration.php index 03c55adb01..890744f52f 100644 --- a/src/CoreShop/Bundle/IndexBundle/DependencyInjection/Configuration.php +++ b/src/CoreShop/Bundle/IndexBundle/DependencyInjection/Configuration.php @@ -169,7 +169,7 @@ private function addPimcoreResourcesSection(ArrayNodeDefinition $node): void ->end() ->scalarNode('permissions') ->cannotBeOverwritten() - ->defaultValue(['index', 'filter']) + ->defaultValue([]) ->end() ->end() ->end() diff --git a/src/CoreShop/Bundle/IndexBundle/Menu/IndexMenuBuilder.php b/src/CoreShop/Bundle/IndexBundle/Menu/IndexMenuBuilder.php index 20db10f7e2..8dddb6d331 100644 --- a/src/CoreShop/Bundle/IndexBundle/Menu/IndexMenuBuilder.php +++ b/src/CoreShop/Bundle/IndexBundle/Menu/IndexMenuBuilder.php @@ -28,7 +28,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $menuItem ->addChild('coreshop_indexes') ->setLabel('coreshop_indexes') - ->setAttribute('permission', 'coreshop_permission_index') + ->setAttribute('permission', 'coreshop_permission_index_list') ->setAttribute('iconCls', 'coreshop_nav_icon_indexes') ->setAttribute('resource', 'coreshop.index') ->setAttribute('function', 'index') @@ -37,7 +37,7 @@ public function buildMenu(ItemInterface $menuItem, FactoryInterface $factory, st $menuItem ->addChild('coreshop_filters') ->setLabel('coreshop_filters') - ->setAttribute('permission', 'coreshop_permission_filter') + ->setAttribute('permission', 'coreshop_permission_filter_list') ->setAttribute('iconCls', 'coreshop_nav_icon_filters') ->setAttribute('resource', 'coreshop.index') ->setAttribute('function', 'filter') diff --git a/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/filter/condition.js b/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/filter/condition.js index d01e677756..2fbb41669a 100644 --- a/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/filter/condition.js +++ b/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/filter/condition.js @@ -40,19 +40,24 @@ coreshop.filter.condition = Class.create({ text: t('coreshop_filters_' + condition), handler: _this.addCondition.bind(_this, condition, {}, true) }); - }); + const buttons = []; + + if (!this.parent || this.parent.isAllowed('edit')) { + buttons.push({ + iconCls: 'pimcore_icon_add', + menu: addMenu + }); + } + this.fieldsContainer = new Ext.Panel({ iconCls: 'coreshop_filters_' + this.type, title: t('coreshop_filters_' + this.label), autoScroll: true, style: 'padding: 10px', forceLayout: true, - tbar: [{ - iconCls: 'pimcore_icon_add', - menu: addMenu - }], + tbar: buttons, border: false }); @@ -72,10 +77,13 @@ coreshop.filter.condition = Class.create({ // create condition var item = new coreshop.filter.conditions[type](this, data); - // add logic for brackets - var tab = this; + const itemLayout = item.getLayout(); + + if (this.parent && !this.parent.isAllowed('edit')) { + itemLayout.disable(); + } - this.fieldsContainer.add(item.getLayout()); + this.fieldsContainer.add(itemLayout); this.fieldsContainer.updateLayout(); } }, diff --git a/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/filter/item.js b/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/filter/item.js index 549f7b5a1e..9fcbe93af6 100644 --- a/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/filter/item.js +++ b/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/filter/item.js @@ -25,6 +25,21 @@ coreshop.filter.item = Class.create(coreshop.resource.item, { indexFieldsStore: null, getPanel: function () { + const buttons = []; + + if (this.isAllowed('edit')) { + buttons.push({ + text: t('clone'), + iconCls: 'pimcore_icon_clone', + handler: this.clone.bind(this) + }); + buttons.push({ + text: t('save'), + iconCls: 'pimcore_icon_apply', + handler: this.save.bind(this) + }); + } + panel = new Ext.TabPanel({ activeTab: 0, title: this.data.name, @@ -32,15 +47,7 @@ coreshop.filter.item = Class.create(coreshop.resource.item, { deferredRender: false, forceLayout: true, iconCls: this.iconCls, - buttons: [{ - text: t('clone'), - iconCls: 'pimcore_icon_clone', - handler: this.clone.bind(this) - }, { - text: t('save'), - iconCls: 'pimcore_icon_apply', - handler: this.save.bind(this) - }], + buttons: buttons, items: this.getItems() }); @@ -152,8 +159,7 @@ coreshop.filter.item = Class.create(coreshop.resource.item, { }); this.settingsForm = Ext.create('Ext.form.Panel', { - iconCls: 'coreshop_icon_settings', - title: t('settings'), + disabled: !this.isAllowed('edit'), bodyStyle: 'padding:10px;', autoScroll: true, border: false, @@ -192,7 +198,13 @@ coreshop.filter.item = Class.create(coreshop.resource.item, { }] }); - return this.settingsForm; + return new Ext.Panel({ + iconCls: 'coreshop_icon_settings', + title: t('settings'), + autoScroll: true, + border: false, + items: [this.settingsForm] + }); }, getSaveData: function () { diff --git a/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/filter/panel.js b/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/filter/panel.js index 6d34f04f1c..c6d0410391 100644 --- a/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/filter/panel.js +++ b/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/filter/panel.js @@ -22,6 +22,7 @@ coreshop.filter.panel = Class.create(coreshop.resource.panel, { storeId: 'coreshop_filters', iconCls: 'coreshop_icon_filters', type: 'coreshop_filters', + permission: 'coreshop_permission_filter', routing: { add: 'coreshop_filter_add', diff --git a/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/index/fields.js b/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/index/fields.js index 1c3f3d7196..61dfac660d 100644 --- a/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/index/fields.js +++ b/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/index/fields.js @@ -49,8 +49,8 @@ coreshop.index.fields = Class.create({ this.configPanel = new Ext.Panel({ layout: 'border', - items: items - + items: items, + disabled: !this.parent.isAllowed('edit'), }); return this.configPanel; @@ -191,6 +191,10 @@ coreshop.index.fields = Class.create({ }, onTreeNodeContextmenu: function (tree, record, item, index, e, eOpts) { + if (!this.parent.isAllowed('edit')) { + return; + } + e.stopEvent(); tree.select(); @@ -273,6 +277,10 @@ coreshop.index.fields = Class.create({ }); tree.addListener('itemdblclick', function (tree, record, item, index, e, eOpts) { + if (!this.parent.isAllowed('edit')) { + return; + } + if ( !record.data.root && ( diff --git a/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/index/item.js b/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/index/item.js index 4e044a2b6d..67ab374fd9 100644 --- a/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/index/item.js +++ b/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/index/item.js @@ -23,6 +23,21 @@ coreshop.index.item = Class.create(coreshop.resource.item, { }, getPanel: function () { + const buttons = []; + + if (this.isAllowed('edit')) { + buttons.push({ + text: t('clone'), + iconCls: 'pimcore_icon_clone', + handler: this.clone.bind(this) + }); + buttons.push({ + text: t('save'), + iconCls: 'pimcore_icon_apply', + handler: this.save.bind(this) + }); + } + return new Ext.TabPanel({ activeTab: 0, title: this.data.name, @@ -30,15 +45,7 @@ coreshop.index.item = Class.create(coreshop.resource.item, { deferredRender: false, forceLayout: true, iconCls: this.iconCls, - buttons: [{ - text: t('clone'), - iconCls: 'pimcore_icon_clone', - handler: this.clone.bind(this) - }, { - text: t('save'), - iconCls: 'pimcore_icon_apply', - handler: this.save.bind(this) - }], + buttons: buttons, items: this.getItems() }); }, @@ -57,8 +64,7 @@ coreshop.index.item = Class.create(coreshop.resource.item, { this.indexWorkerSettings = new Ext.form.Panel({}); this.formPanel = new Ext.panel.Panel({ - iconCls: 'coreshop_icon_settings', - title: t('settings'), + disabled: !this.isAllowed('edit'), bodyStyle: 'padding:20px 5px 20px 5px;', border: false, region: 'center', @@ -136,7 +142,13 @@ coreshop.index.item = Class.create(coreshop.resource.item, { this.getIndexWorkerConfig(this.data.worker); } - return this.formPanel; + return new Ext.Panel({ + iconCls: 'coreshop_icon_settings', + title: t('settings'), + autoScroll: true, + border: false, + items: [this.formPanel] + }); }, getIndexFields: function () { diff --git a/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/index/panel.js b/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/index/panel.js index 6d3616ce89..6c617ada25 100644 --- a/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/index/panel.js +++ b/src/CoreShop/Bundle/IndexBundle/Resources/public/pimcore/js/index/panel.js @@ -19,6 +19,7 @@ coreshop.index.panel = Class.create(coreshop.resource.panel, { storeId: 'coreshop_indexes', iconCls: 'coreshop_icon_indexes', type: 'coreshop_indexes', + permission: 'coreshop_permission_index', routing: { add: 'coreshop_index_add', diff --git a/src/CoreShop/Bundle/IndexBundle/Resources/translations/admin.de.yml b/src/CoreShop/Bundle/IndexBundle/Resources/translations/admin.de.yml index 7c6a2de48c..256c299eba 100644 --- a/src/CoreShop/Bundle/IndexBundle/Resources/translations/admin.de.yml +++ b/src/CoreShop/Bundle/IndexBundle/Resources/translations/admin.de.yml @@ -33,8 +33,16 @@ coreshop_filters_step_count: 'Schrittzähler' coreshop_filters_quantityUnit: 'Mengeneinheit' coreshop_index_interpreter_property: 'Eigenschaft' coreshop_index_interpreter_expression: 'Expression' -coreshop_permission_filter: 'CoreShop: Filter' -coreshop_permission_index: 'CoreShop: Index' +coreshop_permission_filter_list: 'CoreShop: Filter Liste' +coreshop_permission_filter_create: 'CoreShop: Filter erstellen' +coreshop_permission_filter_edit: 'CoreShop: Filter bearbeiten' +coreshop_permission_filter_delete: 'CoreShop: Filter löschen' +coreshop_permission_filter_view: 'CoreShop: Filter ansehen' +coreshop_permission_index_list: 'CoreShop: Index Liste' +coreshop_permission_index_create: 'CoreShop: Index erstellen' +coreshop_permission_index_edit: 'CoreShop: Index bearbeiten' +coreshop_permission_index_delete: 'CoreShop: Index löschen' +coreshop_permission_index_view: 'CoreShop: Index ansehen' coreshop_filters_pre_conditions: 'Vor Bedingungen' coreshop_filters_conditions: 'Bedingungen' coreshop_filters_select: 'Auswahl' diff --git a/src/CoreShop/Bundle/IndexBundle/Resources/translations/admin.en.yml b/src/CoreShop/Bundle/IndexBundle/Resources/translations/admin.en.yml index ec283ba678..12062bb993 100644 --- a/src/CoreShop/Bundle/IndexBundle/Resources/translations/admin.en.yml +++ b/src/CoreShop/Bundle/IndexBundle/Resources/translations/admin.en.yml @@ -32,8 +32,16 @@ coreshop_filters_step_count: 'Step Count' coreshop_filters_quantityUnit: 'Quantity Value' coreshop_index_interpreter_property: 'Property' coreshop_index_interpreter_expression: 'Expression' -coreshop_permission_filter: 'CoreShop: Filter' -coreshop_permission_index: 'CoreShop: Index' +coreshop_permission_filter_list: 'CoreShop Filter: List' +coreshop_permission_filter_create: 'CoreShop Filter: Create' +coreshop_permission_filter_edit: 'CoreShop Filter: Edit' +coreshop_permission_filter_delete: 'CoreShop Filter: Delete' +coreshop_permission_filter_view: 'CoreShop Filter: View' +coreshop_permission_index_list: 'CoreShop Index: List' +coreshop_permission_index_create: 'CoreShop Index: Create' +coreshop_permission_index_edit: 'CoreShop Index: Edit' +coreshop_permission_index_delete: 'CoreShop Index: Delete' +coreshop_permission_index_view: 'CoreShop Index: View' coreshop_filters_pre_conditions: 'Pre-Conditions' coreshop_filters_conditions: 'Conditions' coreshop_filters_select: 'Select' diff --git a/src/CoreShop/Bundle/IndexBundle/Resources/translations/admin.it.yml b/src/CoreShop/Bundle/IndexBundle/Resources/translations/admin.it.yml index 7055915c93..0c11d1d38b 100644 --- a/src/CoreShop/Bundle/IndexBundle/Resources/translations/admin.it.yml +++ b/src/CoreShop/Bundle/IndexBundle/Resources/translations/admin.it.yml @@ -23,8 +23,6 @@ coreshop_product_similarity: 'Prodotti simili' coreshop_filters_similarity_weight: 'Peso' coreshop_index_interpreter_property: 'Proprietà' coreshop_index_interpreter_expression: 'Espressione' -coreshop_permission_filter: 'CoreShop: Filtro' -coreshop_permission_index: 'CoreShop: Indice' coreshop_filters_pre_conditions: 'Pre-Condizioni' coreshop_filters_conditions: 'Condizioni' coreshop_filters_category_select: 'Categoria' diff --git a/src/CoreShop/Bundle/NotificationBundle/DependencyInjection/Configuration.php b/src/CoreShop/Bundle/NotificationBundle/DependencyInjection/Configuration.php index 71fe6c83c9..dfbabcd9dc 100644 --- a/src/CoreShop/Bundle/NotificationBundle/DependencyInjection/Configuration.php +++ b/src/CoreShop/Bundle/NotificationBundle/DependencyInjection/Configuration.php @@ -96,7 +96,11 @@ private function addPimcoreResourcesSection(ArrayNodeDefinition $node): void ->end() ->scalarNode('permissions') ->cannotBeOverwritten() - ->defaultValue(['notification']) + ->defaultValue([ + 'notification_show', + 'notification_list', + 'notification_edit', + ]) ->end() ->end() ->end() diff --git a/src/CoreShop/Bundle/NotificationBundle/Resources/public/pimcore/js/rule/action.js b/src/CoreShop/Bundle/NotificationBundle/Resources/public/pimcore/js/rule/action.js index 95e60ddfe0..783a0b3234 100644 --- a/src/CoreShop/Bundle/NotificationBundle/Resources/public/pimcore/js/rule/action.js +++ b/src/CoreShop/Bundle/NotificationBundle/Resources/public/pimcore/js/rule/action.js @@ -14,8 +14,9 @@ pimcore.registerNS('coreshop.notification.rule.action'); coreshop.notification.rule.action = Class.create(coreshop.rules.action, { - initialize: function (actions, type) { + initialize: function (actions, panel, type) { this.actions = actions; + this.panel = panel; this.type = type; }, diff --git a/src/CoreShop/Bundle/NotificationBundle/Resources/public/pimcore/js/rule/condition.js b/src/CoreShop/Bundle/NotificationBundle/Resources/public/pimcore/js/rule/condition.js index 6396d2a9a7..a02c8da373 100644 --- a/src/CoreShop/Bundle/NotificationBundle/Resources/public/pimcore/js/rule/condition.js +++ b/src/CoreShop/Bundle/NotificationBundle/Resources/public/pimcore/js/rule/condition.js @@ -14,8 +14,9 @@ pimcore.registerNS('coreshop.notification.rule.condition'); coreshop.notification.rule.condition = Class.create(coreshop.rules.condition, { - initialize: function (conditions, type) { + initialize: function (conditions, panel, type) { this.conditions = conditions; + this.panel = panel; this.type = type; }, diff --git a/src/CoreShop/Bundle/NotificationBundle/Resources/public/pimcore/js/rule/item.js b/src/CoreShop/Bundle/NotificationBundle/Resources/public/pimcore/js/rule/item.js index a7816cf4d3..ef6ff89fde 100644 --- a/src/CoreShop/Bundle/NotificationBundle/Resources/public/pimcore/js/rule/item.js +++ b/src/CoreShop/Bundle/NotificationBundle/Resources/public/pimcore/js/rule/item.js @@ -23,6 +23,15 @@ coreshop.notification.rule.item = Class.create(coreshop.rules.item, { getPanel: function () { var items = this.getItems(); + const buttons = []; + + if (this.isAllowed('edit')) { + buttons.push({ + text: t('save'), + iconCls: 'pimcore_icon_save', + handler: this.save.bind(this) + }); + } this.panel = new Ext.TabPanel({ activeTab: 0, @@ -31,11 +40,7 @@ coreshop.notification.rule.item = Class.create(coreshop.rules.item, { deferredRender: false, forceLayout: true, iconCls: this.iconCls, - buttons: [{ - text: t('save'), - iconCls: 'pimcore_icon_apply', - handler: this.save.bind(this) - }], + buttons: buttons, items: items }); @@ -61,8 +66,7 @@ coreshop.notification.rule.item = Class.create(coreshop.rules.item, { }); this.settingsForm = Ext.create('Ext.form.Panel', { - iconCls: 'coreshop_icon_settings', - title: t('settings'), + disabled: !this.isAllowed('edit'), bodyStyle: 'padding:10px;', autoScroll: true, border: false, @@ -98,7 +102,13 @@ coreshop.notification.rule.item = Class.create(coreshop.rules.item, { ] }); - return this.settingsForm; + return new Ext.Panel({ + iconCls: 'coreshop_icon_settings', + title: t('settings'), + autoScroll: true, + border: false, + items: [this.settingsForm] + }); }, getItems: function () { @@ -128,8 +138,8 @@ coreshop.notification.rule.item = Class.create(coreshop.rules.item, { var allowedActions = this.parentPanel.getActionsForType(type); var allowedConditions = this.parentPanel.getConditionsForType(type); - this.actions = new actionContainerClass(allowedActions, type); - this.conditions = new conditionContainerClass(allowedConditions, type); + this.actions = new actionContainerClass(allowedActions, this.parentPanel, type); + this.conditions = new conditionContainerClass(allowedConditions, this.parentPanel, type); var items = [ this.conditions.getLayout(), diff --git a/src/CoreShop/Bundle/NotificationBundle/Resources/public/pimcore/js/rule/panel.js b/src/CoreShop/Bundle/NotificationBundle/Resources/public/pimcore/js/rule/panel.js index b27c5afb20..309397d441 100644 --- a/src/CoreShop/Bundle/NotificationBundle/Resources/public/pimcore/js/rule/panel.js +++ b/src/CoreShop/Bundle/NotificationBundle/Resources/public/pimcore/js/rule/panel.js @@ -22,6 +22,7 @@ coreshop.notification.rule.panel = Class.create(coreshop.rules.panel, { storeId: 'coreshop_notification_rules', iconCls: 'coreshop_icon_notification_rule', type: 'coreshop_notification_rule', + permission: 'coreshop_permission_notification', routing: { add: 'coreshop_notification_rule_add', diff --git a/src/CoreShop/Bundle/OrderBundle/DependencyInjection/Configuration.php b/src/CoreShop/Bundle/OrderBundle/DependencyInjection/Configuration.php index 56c083dcbb..42f4bdb931 100644 --- a/src/CoreShop/Bundle/OrderBundle/DependencyInjection/Configuration.php +++ b/src/CoreShop/Bundle/OrderBundle/DependencyInjection/Configuration.php @@ -420,7 +420,6 @@ private function addPimcoreResourcesSection(ArrayNodeDefinition $node): void ->scalarNode('permissions') ->cannotBeOverwritten() ->defaultValue([ - 'cart_price_rule', 'order_list', 'order_detail', 'order_create', diff --git a/src/CoreShop/Bundle/OrderBundle/Resources/public/pimcore/js/cart/pricerules/item.js b/src/CoreShop/Bundle/OrderBundle/Resources/public/pimcore/js/cart/pricerules/item.js index ad34e544a7..624bcf101f 100644 --- a/src/CoreShop/Bundle/OrderBundle/Resources/public/pimcore/js/cart/pricerules/item.js +++ b/src/CoreShop/Bundle/OrderBundle/Resources/public/pimcore/js/cart/pricerules/item.js @@ -21,6 +21,16 @@ coreshop.cart.pricerules.item = Class.create(coreshop.rules.item, { }, getPanel: function () { + const buttons = []; + + if (this.isAllowed('edit')) { + buttons.push({ + text: t('save'), + iconCls: 'pimcore_icon_save', + handler: this.save.bind(this) + }); + } + this.panel = new Ext.TabPanel({ activeTab: 0, title: this.data.name, @@ -28,11 +38,7 @@ coreshop.cart.pricerules.item = Class.create(coreshop.rules.item, { deferredRender: false, forceLayout: true, iconCls: this.iconCls, - buttons: [{ - text: t('save'), - iconCls: 'pimcore_icon_apply', - handler: this.save.bind(this) - }], + buttons: buttons, items: this.getItems() }); @@ -71,11 +77,8 @@ coreshop.cart.pricerules.item = Class.create(coreshop.rules.item, { }); this.settingsForm = Ext.create('Ext.form.Panel', { - iconCls: 'coreshop_icon_settings', - title: t('settings'), bodyStyle: 'padding:10px;', - autoScroll: true, - border: false, + disabled: !this.isAllowed('edit'), items: [{ xtype: 'textfield', name: 'name', @@ -126,7 +129,13 @@ coreshop.cart.pricerules.item = Class.create(coreshop.rules.item, { }] }); - return this.settingsForm; + return new Ext.Panel({ + iconCls: 'coreshop_icon_settings', + title: t('settings'), + autoScroll: true, + border: false, + items: [this.settingsForm] + }); }, addVoucherCodes: function () { @@ -249,6 +258,7 @@ coreshop.cart.pricerules.item = Class.create(coreshop.rules.item, { { xtype: 'button', text: t('coreshop_cart_pricerule_create_voucher'), + disabled: !this.isAllowed('edit'), handler: function () { this.openVoucherCreateDialog(); }.bind(this) @@ -256,6 +266,7 @@ coreshop.cart.pricerules.item = Class.create(coreshop.rules.item, { { xtype: 'button', text: t('coreshop_cart_pricerule_generate_vouchers'), + disabled: !this.isAllowed('edit'), handler: function () { this.openVoucherGenerationDialog(); }.bind(this) @@ -263,6 +274,7 @@ coreshop.cart.pricerules.item = Class.create(coreshop.rules.item, { { xtype: 'button', text: t('coreshop_cart_pricerule_vouchers_export'), + disabled: !this.isAllowed('edit'), handler: function () { var page = store.currentPage; var size = store.getPageSize(); diff --git a/src/CoreShop/Bundle/OrderBundle/Resources/public/pimcore/js/cart/pricerules/panel.js b/src/CoreShop/Bundle/OrderBundle/Resources/public/pimcore/js/cart/pricerules/panel.js index ba1d99663f..5a2770c05e 100644 --- a/src/CoreShop/Bundle/OrderBundle/Resources/public/pimcore/js/cart/pricerules/panel.js +++ b/src/CoreShop/Bundle/OrderBundle/Resources/public/pimcore/js/cart/pricerules/panel.js @@ -22,6 +22,7 @@ coreshop.cart.pricerules.panel = Class.create(coreshop.rules.panel, { storeId: 'coreshop_cart_price_rules', iconCls: 'coreshop_icon_price_rule', type: 'coreshop_cart_pricerules', + permission: 'coreshop_permission_cart_price_rule', routing: { add: 'coreshop_cart_price_rule_add', diff --git a/src/CoreShop/Bundle/OrderBundle/Resources/translations/admin.de.yml b/src/CoreShop/Bundle/OrderBundle/Resources/translations/admin.de.yml index 08898a6a44..d8f7863141 100644 --- a/src/CoreShop/Bundle/OrderBundle/Resources/translations/admin.de.yml +++ b/src/CoreShop/Bundle/OrderBundle/Resources/translations/admin.de.yml @@ -229,7 +229,11 @@ coreshop_subtotal: 'Zwischensumme (inkl. Mwst.)' coreshop_subtotal_tax: 'Zwischensumme Steuer' coreshop_subtotal_without_tax: 'Zwischensumme (ohne Mwst.)' coreshop_total_tax: 'Steuer' -coreshop_permission_cart_price_rule: 'CoreShop: Warenkorbpreisregel' +coreshop_permission_cart_price_rule_list: 'CoreShop: Warenkorbpreisregel Liste' +coreshop_permission_cart_price_rule_create: 'CoreShop: Warenkorbpreisregel erstellen' +coreshop_permission_cart_price_rule_view: 'CoreShop: Warenkorbpreisregel anzeigen' +coreshop_permission_cart_price_rule_edit: 'CoreShop: Warenkorbpreisregel bearbeiten' +coreshop_permission_cart_price_rule_delete: 'CoreShop: Warenkorbpreisregel löschen' coreshop_permission_order_create: 'CoreShop: Bestellung erstellen' coreshop_permission_order_list: 'CoreShop: Bestellungen' coreshop_permission_order_detail: 'CoreShop: Bestellung Detail' diff --git a/src/CoreShop/Bundle/OrderBundle/Resources/translations/admin.en.yml b/src/CoreShop/Bundle/OrderBundle/Resources/translations/admin.en.yml index a63c49288e..f804d37830 100644 --- a/src/CoreShop/Bundle/OrderBundle/Resources/translations/admin.en.yml +++ b/src/CoreShop/Bundle/OrderBundle/Resources/translations/admin.en.yml @@ -233,7 +233,11 @@ coreshop_subtotal: 'Subtotal (incl. Tax)' coreshop_subtotal_tax: 'Subtotal Tax' coreshop_subtotal_without_tax: 'Subtotal (excl Tax.)' coreshop_total_tax: 'Tax' -coreshop_permission_cart_price_rule: 'CoreShop: Cart Price Rule' +coreshop_permission_cart_price_rule_list: 'CoreShop: Cart Price Rule List' +coreshop_permission_cart_price_rule_create: 'CoreShop: Cart Price Rule Create' +coreshop_permission_cart_price_rule_view: 'CoreShop: Cart Price Rule View' +coreshop_permission_cart_price_rule_edit: 'CoreShop: Cart Price Rule Edit' +coreshop_permission_cart_price_rule_delete: 'CoreShop: Cart Price Rule Delete' coreshop_permission_order_create: 'CoreShop: Order Create' coreshop_permission_order_list: 'CoreShop: Order List' coreshop_permission_order_detail: 'CoreShop: Order Detail' diff --git a/src/CoreShop/Bundle/PaymentBundle/DependencyInjection/Configuration.php b/src/CoreShop/Bundle/PaymentBundle/DependencyInjection/Configuration.php index 9b40c8f52a..ebbfcc1124 100644 --- a/src/CoreShop/Bundle/PaymentBundle/DependencyInjection/Configuration.php +++ b/src/CoreShop/Bundle/PaymentBundle/DependencyInjection/Configuration.php @@ -215,7 +215,7 @@ private function addPimcoreResourcesSection(ArrayNodeDefinition $node): void ->end() ->scalarNode('permissions') ->cannotBeOverwritten() - ->defaultValue(['payment_provider', 'payment_provider_rule']) + ->defaultValue([]) ->end() ->end() ->end() diff --git a/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/css/payment.css b/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/css/payment.css index 16cae317c9..738654c024 100644 --- a/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/css/payment.css +++ b/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/css/payment.css @@ -31,7 +31,6 @@ body.pimcore_version_11 .coreshop_nav_icon_payment_provider { body.pimcore_version_11 .coreshop_nav_icon_payment_provider_rule, .coreshop_rule_icon_action_paymentProviderRule, .coreshop_rule_icon_condition_paymentProviderRule { ->>>>>>> 3.2 background: url(../img/payment-provider-rule_white.svg) center center no-repeat !important; } diff --git a/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/js/paymentproviderrule/item.js b/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/js/paymentproviderrule/item.js index 56a78d6283..119bf1b664 100644 --- a/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/js/paymentproviderrule/item.js +++ b/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/js/paymentproviderrule/item.js @@ -23,6 +23,15 @@ coreshop.paymentproviderrule.item = Class.create(coreshop.rules.item, { getPanel: function () { var items = this.getItems(); + const buttons = []; + + if (this.isAllowed('edit')) { + buttons.push({ + text: t('save'), + iconCls: 'pimcore_icon_save', + handler: this.save.bind(this) + }); + } this.panel = new Ext.TabPanel({ activeTab: 0, @@ -31,11 +40,7 @@ coreshop.paymentproviderrule.item = Class.create(coreshop.rules.item, { deferredRender: false, forceLayout: true, iconCls: this.iconCls, - buttons: [{ - text: t('save'), - iconCls: 'pimcore_icon_apply', - handler: this.save.bind(this) - }], + buttons: buttons, items: items }); @@ -64,8 +69,7 @@ coreshop.paymentproviderrule.item = Class.create(coreshop.rules.item, { }); this.settingsForm = Ext.create('Ext.form.Panel', { - iconCls: 'coreshop_icon_settings', - title: t('settings'), + disabled: !this.isAllowed('edit'), bodyStyle: 'padding:10px;', autoScroll: true, border: false, @@ -92,7 +96,13 @@ coreshop.paymentproviderrule.item = Class.create(coreshop.rules.item, { }] }); - return this.settingsForm; + return new Ext.Panel({ + iconCls: 'coreshop_icon_settings', + title: t('settings'), + autoScroll: true, + border: false, + items: [this.settingsForm] + }); }, diff --git a/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/js/paymentproviderrule/panel.js b/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/js/paymentproviderrule/panel.js index f8a1c6b0bc..a6919aaae0 100644 --- a/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/js/paymentproviderrule/panel.js +++ b/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/js/paymentproviderrule/panel.js @@ -20,6 +20,7 @@ coreshop.paymentproviderrule.panel = Class.create(coreshop.rules.panel, { storeId: 'coreshop_payment_provider_rules', iconCls: 'coreshop_nav_icon_payment_provider_rule', type: 'coreshop_payment_provider_rule', + permission: 'coreshop_permission_payment_provider_rule', routing: { add: 'coreshop_payment_provider_rule_add', diff --git a/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/js/provider/item.js b/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/js/provider/item.js index 4134eea061..6b1370cd50 100644 --- a/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/js/provider/item.js +++ b/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/js/provider/item.js @@ -22,6 +22,16 @@ coreshop.provider.item = Class.create(coreshop.resource.item, { }, getPanel: function () { + const buttons = []; + + if (this.isAllowed('edit')) { + buttons.push({ + text: t('save'), + iconCls: 'pimcore_icon_save', + handler: this.save.bind(this) + }); + } + return new Ext.TabPanel({ activeTab: 0, title: this.getTitleText(), @@ -29,18 +39,14 @@ coreshop.provider.item = Class.create(coreshop.resource.item, { deferredRender: false, forceLayout: true, iconCls: this.iconCls, - buttons: [{ - text: t('save'), - iconCls: 'pimcore_icon_apply', - handler: this.save.bind(this) - }], + buttons: buttons, items: this.getItems() }); }, getItems: function () { return [ - this.getFormPanel(), + this.getSettings(), this.getPaymentLocationsAndCosts() ]; @@ -50,7 +56,7 @@ coreshop.provider.item = Class.create(coreshop.resource.item, { return this.data.identifier; }, - getFormPanel: function () { + getSettings: function () { var data = this.data, langTabs = []; @@ -146,7 +152,9 @@ coreshop.provider.item = Class.create(coreshop.resource.item, { items: [ { xtype: 'fieldset', + disabled: !this.isAllowed('edit'), autoHeight: true, + border: false, labelWidth: 350, defaultType: 'textfield', defaults: {width: '100%'}, @@ -187,6 +195,7 @@ coreshop.provider.item = Class.create(coreshop.resource.item, { }.bind(this)); this.paymentProviderRuleGroupsGrid = Ext.create('Ext.grid.Panel', { + disabled: !this.isAllowed('edit'), columns: [ { header: t('coreshop_payment_provider_rule'), diff --git a/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/js/provider/panel.js b/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/js/provider/panel.js index 1c3f49d3e0..1b6cb6d04b 100644 --- a/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/js/provider/panel.js +++ b/src/CoreShop/Bundle/PaymentBundle/Resources/public/pimcore/js/provider/panel.js @@ -21,6 +21,7 @@ coreshop.provider.panel = Class.create(coreshop.resource.panel, { storeId: 'coreshop_payment_providers', iconCls: 'coreshop_icon_payment_provider', type: 'coreshop_payment_provider', + permission: 'coreshop_permission_payment_provider', routing: { add: 'coreshop_payment_provider_add', diff --git a/src/CoreShop/Bundle/PaymentBundle/Resources/translations/admin.de.yml b/src/CoreShop/Bundle/PaymentBundle/Resources/translations/admin.de.yml index e1ea2a727a..a6ff6f5415 100644 --- a/src/CoreShop/Bundle/PaymentBundle/Resources/translations/admin.de.yml +++ b/src/CoreShop/Bundle/PaymentBundle/Resources/translations/admin.de.yml @@ -11,6 +11,7 @@ coreshop_username: 'Benutzername' coreshop_password: 'Passwort' coreshop_signature: 'Signatur' coreshop_permission_payment_provider: 'CoreShop: Zahlungsanbieter' +coreshop_permission_payment_provider_rule: 'CoreShop: Zahlungsanbieterregel' coreshop_payment_sofort_config_key: 'Konfigurationsschlüssel' coreshop_paypal_sandbox: 'Sandbox' coreshop_logo: 'Logo' diff --git a/src/CoreShop/Bundle/PaymentBundle/Resources/translations/admin.en.yml b/src/CoreShop/Bundle/PaymentBundle/Resources/translations/admin.en.yml index 3338ed5c90..ecca81fc3d 100644 --- a/src/CoreShop/Bundle/PaymentBundle/Resources/translations/admin.en.yml +++ b/src/CoreShop/Bundle/PaymentBundle/Resources/translations/admin.en.yml @@ -9,7 +9,16 @@ coreshop_payment_provider_factory: 'Type' coreshop_username: 'Username' coreshop_password: 'Password' coreshop_signature: 'Signature' -coreshop_permission_payment_provider: 'CoreShop: Payment Provider' +coreshop_permission_payment_provider_list: 'CoreShop Payment Provider: List' +coreshop_permission_payment_provider_create: 'CoreShop Payment Provider: Create' +coreshop_permission_payment_provider_edit: 'CoreShop Payment Provider: Edit' +coreshop_permission_payment_provider_delete: 'CoreShop Payment Provider: Delete' +coreshop_permission_payment_provider_view: 'CoreShop Payment Provider: View' +coreshop_permission_payment_provider_rule_list: 'CoreShop Payment Provider Rule: List' +coreshop_permission_payment_provider_rule_create: 'CoreShop Payment Provider Rule: Create' +coreshop_permission_payment_provider_rule_edit: 'CoreShop Payment Provider Rule: Edit' +coreshop_permission_payment_provider_rule_delete: 'CoreShop Payment Provider Rule: Delete' +coreshop_permission_payment_provider_rule_view: 'CoreShop Payment Provider Rule: View' coreshop_payment_sofort_config_key: 'Config Key' coreshop_paypal_sandbox: 'Sandbox' coreshop_logo: 'Logo' diff --git a/src/CoreShop/Bundle/PaymentBundle/Resources/translations/admin.it.yml b/src/CoreShop/Bundle/PaymentBundle/Resources/translations/admin.it.yml index 7394a84937..7993b16438 100644 --- a/src/CoreShop/Bundle/PaymentBundle/Resources/translations/admin.it.yml +++ b/src/CoreShop/Bundle/PaymentBundle/Resources/translations/admin.it.yml @@ -5,4 +5,3 @@ coreshop_identifier: 'Identificativo' coreshop_position: 'Posizione' coreshop_instructions: 'Istruzioni' coreshop_payment_provider_factory: 'Tipo' -coreshop_permission_payment_provider: 'CoreShop: Provider di pagamento' diff --git a/src/CoreShop/Bundle/PaymentBundle/Resources/translations/admin.sv.yml b/src/CoreShop/Bundle/PaymentBundle/Resources/translations/admin.sv.yml index 96fe80f918..3572268d0c 100644 --- a/src/CoreShop/Bundle/PaymentBundle/Resources/translations/admin.sv.yml +++ b/src/CoreShop/Bundle/PaymentBundle/Resources/translations/admin.sv.yml @@ -1,3 +1,2 @@ --- coreshop_payment_provider: 'Betalningsleverantör' -coreshop_permission_payment_provider: 'CoreShop: Betalningsleverantör' diff --git a/src/CoreShop/Bundle/PayumPaymentBundle/Controller/PaymentProviderController.php b/src/CoreShop/Bundle/PayumPaymentBundle/Controller/PaymentProviderController.php index dfaabd3641..4f94e941ee 100644 --- a/src/CoreShop/Bundle/PayumPaymentBundle/Controller/PaymentProviderController.php +++ b/src/CoreShop/Bundle/PayumPaymentBundle/Controller/PaymentProviderController.php @@ -18,6 +18,7 @@ namespace CoreShop\Bundle\PayumPaymentBundle\Controller; use CoreShop\Bundle\ResourceBundle\Controller\ResourceController; +use CoreShop\Bundle\ResourceBundle\ResourcePermission; use CoreShop\Component\PayumPayment\Model\PaymentProviderInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; @@ -27,7 +28,7 @@ class PaymentProviderController extends ResourceController { public function getAction(Request $request): JsonResponse { - $this->isGrantedOr403(); + $this->isGrantedOr403(ResourcePermission::VIEW); $resources = $this->findOr404((int) $this->getParameterFromRequest($request, 'id')); diff --git a/src/CoreShop/Bundle/ProductBundle/DependencyInjection/Configuration.php b/src/CoreShop/Bundle/ProductBundle/DependencyInjection/Configuration.php index 661d92741f..7a4261f8d4 100644 --- a/src/CoreShop/Bundle/ProductBundle/DependencyInjection/Configuration.php +++ b/src/CoreShop/Bundle/ProductBundle/DependencyInjection/Configuration.php @@ -389,7 +389,7 @@ private function addPimcoreResourcesSection(ArrayNodeDefinition $node): void ->end() ->scalarNode('permissions') ->cannotBeOverwritten() - ->defaultValue(['product_price_rule', 'product_unit']) + ->defaultValue([]) ->end() ->end() ->end() diff --git a/src/CoreShop/Bundle/ProductBundle/Resources/public/pimcore/js/product/pricerule/item.js b/src/CoreShop/Bundle/ProductBundle/Resources/public/pimcore/js/product/pricerule/item.js index 45db4fc6ad..a10ea20283 100644 --- a/src/CoreShop/Bundle/ProductBundle/Resources/public/pimcore/js/product/pricerule/item.js +++ b/src/CoreShop/Bundle/ProductBundle/Resources/public/pimcore/js/product/pricerule/item.js @@ -43,11 +43,10 @@ coreshop.product.pricerule.item = Class.create(coreshop.rules.item, { this.settingsForm = Ext.create('Ext.form.Panel', { - iconCls: 'coreshop_icon_settings', - title: t('settings'), bodyStyle: 'padding:10px;', autoScroll: true, border: false, + disabled: !this.isAllowed('edit'), items: [{ xtype: 'textfield', name: 'name', @@ -82,10 +81,26 @@ coreshop.product.pricerule.item = Class.create(coreshop.rules.item, { }] }); - return this.settingsForm; + return new Ext.Panel({ + iconCls: 'coreshop_icon_settings', + title: t('settings'), + autoScroll: true, + border: false, + items: [this.settingsForm] + }); }, getPanel: function () { + const buttons = []; + + if (this.isAllowed('edit')) { + buttons.push({ + text: t('save'), + iconCls: 'pimcore_icon_save', + handler: this.save.bind(this) + }); + } + this.panel = new Ext.TabPanel({ activeTab: 0, title: this.data.name, @@ -93,11 +108,7 @@ coreshop.product.pricerule.item = Class.create(coreshop.rules.item, { deferredRender: false, forceLayout: true, iconCls: this.iconCls, - buttons: [{ - text: t('save'), - iconCls: 'pimcore_icon_apply', - handler: this.save.bind(this) - }], + buttons: buttons, items: this.getItems() }); diff --git a/src/CoreShop/Bundle/ProductBundle/Resources/public/pimcore/js/product/pricerule/panel.js b/src/CoreShop/Bundle/ProductBundle/Resources/public/pimcore/js/product/pricerule/panel.js index 00d74d37cd..b6eb74df01 100644 --- a/src/CoreShop/Bundle/ProductBundle/Resources/public/pimcore/js/product/pricerule/panel.js +++ b/src/CoreShop/Bundle/ProductBundle/Resources/public/pimcore/js/product/pricerule/panel.js @@ -20,6 +20,7 @@ coreshop.product.pricerule.panel = Class.create(coreshop.rules.panel, { storeId: 'coreshop_product_price_rule', iconCls: 'coreshop_icon_price_rule', type: 'coreshop_product_pricerules', + permission: 'coreshop_permission_product_price_rule', /** * @var array diff --git a/src/CoreShop/Bundle/ProductBundle/Resources/public/pimcore/js/product/unit/item.js b/src/CoreShop/Bundle/ProductBundle/Resources/public/pimcore/js/product/unit/item.js index 8aeade3e6a..3dadb00d38 100644 --- a/src/CoreShop/Bundle/ProductBundle/Resources/public/pimcore/js/product/unit/item.js +++ b/src/CoreShop/Bundle/ProductBundle/Resources/public/pimcore/js/product/unit/item.js @@ -20,28 +20,7 @@ coreshop.product.unit.item = Class.create(coreshop.resource.item, { save: 'coreshop_product_unit_save' }, - getPanel: function () { - this.panel = new Ext.TabPanel({ - activeTab: 0, - closable: true, - deferredRender: false, - forceLayout: true, - iconCls: this.iconCls, - items: this.getItems(), - buttons: [{ - text: t('save'), - iconCls: 'pimcore_icon_apply', - handler: this.save.bind(this) - }], - tabConfig: { - html: this.data.name - } - }); - - return this.panel; - }, - - getItems: function () { + getFormPanelItems: function () { var data = this.data, langTabs = []; @@ -80,37 +59,28 @@ coreshop.product.unit.item = Class.create(coreshop.resource.item, { langTabs.push(tab); }); - this.settingsForm = Ext.create('Ext.form.Panel', { - iconCls: 'coreshop_icon_settings', - title: t('settings'), - bodyStyle: 'padding:10px;', - autoScroll: true, - border: false, - items: [{ - xtype: 'textfield', - name: 'name', - fieldLabel: t('coreshop_product_unit_name'), - width: 250, - value: data.name, - enableKeyEvents: true, - listeners: { - keyup: function (field) { - this.panel.setTitle(field.getValue()); - }.bind(this) - } - }, { - xtype: 'tabpanel', - activeTab: 0, - defaults: { - autoHeight: true, - bodyStyle: 'padding:10px;' - }, - width: '100%', - items: langTabs - }] - }); - - return this.settingsForm; + return [{ + xtype: 'textfield', + name: 'name', + fieldLabel: t('coreshop_product_unit_name'), + width: 250, + value: data.name, + enableKeyEvents: true, + listeners: { + keyup: function (field) { + this.panel.setTitle(field.getValue()); + }.bind(this) + } + }, { + xtype: 'tabpanel', + activeTab: 0, + defaults: { + autoHeight: true, + bodyStyle: 'padding:10px;' + }, + width: '100%', + items: langTabs + }]; }, getSaveData: function () { diff --git a/src/CoreShop/Bundle/ProductBundle/Resources/public/pimcore/js/product/unit/panel.js b/src/CoreShop/Bundle/ProductBundle/Resources/public/pimcore/js/product/unit/panel.js index 763353d572..bf18bf8bc1 100644 --- a/src/CoreShop/Bundle/ProductBundle/Resources/public/pimcore/js/product/unit/panel.js +++ b/src/CoreShop/Bundle/ProductBundle/Resources/public/pimcore/js/product/unit/panel.js @@ -18,6 +18,7 @@ coreshop.product.unit.panel = Class.create(coreshop.resource.panel, { storeId: 'coreshop_product_units', iconCls: 'coreshop_icon_product_units', type: 'coreshop_product_units', + permission: 'coreshop_permission_product_unit', routing : { add: 'coreshop_product_unit_add', diff --git a/src/CoreShop/Bundle/ProductBundle/Resources/translations/admin.de.yml b/src/CoreShop/Bundle/ProductBundle/Resources/translations/admin.de.yml index df7700ea2a..e744a83879 100644 --- a/src/CoreShop/Bundle/ProductBundle/Resources/translations/admin.de.yml +++ b/src/CoreShop/Bundle/ProductBundle/Resources/translations/admin.de.yml @@ -15,8 +15,16 @@ coreshop_action_notDiscountableCustomAttributes: 'Nicht rabattierbare Attribute' coreshop_condition_weight_minWeight: 'Min Gewicht' coreshop_condition_weight_maxWeight: 'Max Gewicht' coreshop_priority: 'Priorität' -coreshop_permission_product_price_rule: 'CoreShop: Produkt Preis Regel' -coreshop_permission_product_unit: 'CoreShop: Produkteinheiten' +coreshop_permission_product_price_rule_list: 'CoreShop: Produkt Preis Regel Liste' +coreshop_permission_product_price_rule_create: 'CoreShop: Produkt Preis Regel erstellen' +coreshop_permission_product_price_rule_edit: 'CoreShop: Produkt Preis Regel bearbeiten' +coreshop_permission_product_price_rule_delete: 'CoreShop: Produkt Preis Regel löschen' +coreshop_permission_product_price_rule_view: 'CoreShop: Produkt Preis Regel ansehen' +coreshop_permission_product_unit_list: 'CoreShop: Produkteinheiten Liste' +coreshop_permission_product_unit_create: 'CoreShop: Produkteinheit erstellen' +coreshop_permission_product_unit_edit: 'CoreShop: Produkteinheit bearbeiten' +coreshop_permission_product_unit_delete: 'CoreShop: Produkteinheit löschen' +coreshop_permission_product_unit_view: 'CoreShop: Produkteinheit ansehen' coreshop_condition_nested: 'Verschachtelte Regeln' coreshop_condition_products: 'Produkte' coreshop_condition_timespan: 'Zeitspanne' diff --git a/src/CoreShop/Bundle/ProductBundle/Resources/translations/admin.en.yml b/src/CoreShop/Bundle/ProductBundle/Resources/translations/admin.en.yml index a0ef0eabcd..2ee1edb008 100644 --- a/src/CoreShop/Bundle/ProductBundle/Resources/translations/admin.en.yml +++ b/src/CoreShop/Bundle/ProductBundle/Resources/translations/admin.en.yml @@ -14,8 +14,16 @@ coreshop_action_discountPrice: 'Discount Price' coreshop_condition_weight_minWeight: 'Min Weight' coreshop_condition_weight_maxWeight: 'Max Weight' coreshop_priority: 'Priority' -coreshop_permission_product_price_rule: 'CoreShop: Product Price Rule' -coreshop_permission_product_unit: 'CoreShop: Product Unit' +coreshop_permission_product_price_rule_list: 'CoreShop Product Price Rule: List' +coreshop_permission_product_price_rule_create: 'CoreShop Product Price Rule: Create' +coreshop_permission_product_price_rule_edit: 'CoreShop Product Price Rule: Edit' +coreshop_permission_product_price_rule_delete: 'CoreShop Product Price Rule: Delete' +coreshop_permission_product_price_rule_view: 'CoreShop Product Price Rule: View' +coreshop_permission_product_unit_list: 'CoreShop Product Unit: List' +coreshop_permission_product_unit_create: 'CoreShop Product Unit: Create' +coreshop_permission_product_unit_edit: 'CoreShop Product Unit: Edit' +coreshop_permission_product_unit_delete: 'CoreShop Product Unit: Delete' +coreshop_permission_product_unit_view: 'CoreShop Product Unit: View' coreshop_condition_nested: 'Nested Rules' coreshop_condition_products: 'Products' coreshop_condition_timespan: 'Timespan' diff --git a/src/CoreShop/Bundle/ProductBundle/Resources/translations/admin.it.yml b/src/CoreShop/Bundle/ProductBundle/Resources/translations/admin.it.yml index e4e9e715c0..ce50887be5 100644 --- a/src/CoreShop/Bundle/ProductBundle/Resources/translations/admin.it.yml +++ b/src/CoreShop/Bundle/ProductBundle/Resources/translations/admin.it.yml @@ -12,7 +12,6 @@ coreshop_inherit: 'Eredita' coreshop_condition_weight_minWeight: 'Peso minimo' coreshop_condition_weight_maxWeight: 'Peso massimo' coreshop_priority: 'Priorità' -coreshop_permission_product_price_rule: 'CoreShop: Regola di prezzo del prodotto' coreshop_permission_product_unit: 'CoreShop: Unità di prodotto' coreshop_condition_nested: 'Regole annidate' coreshop_condition_products: 'Prodotti' diff --git a/src/CoreShop/Bundle/ProductQuantityPriceRulesBundle/DependencyInjection/Configuration.php b/src/CoreShop/Bundle/ProductQuantityPriceRulesBundle/DependencyInjection/Configuration.php index af66c84a60..ed585668c9 100644 --- a/src/CoreShop/Bundle/ProductQuantityPriceRulesBundle/DependencyInjection/Configuration.php +++ b/src/CoreShop/Bundle/ProductQuantityPriceRulesBundle/DependencyInjection/Configuration.php @@ -128,7 +128,7 @@ private function addPimcoreResourcesSection(ArrayNodeDefinition $node): void ->end() ->scalarNode('permissions') ->cannotBeOverwritten() - ->defaultValue(['notification']) + ->defaultValue([]) ->end() ->end() ->end() diff --git a/src/CoreShop/Bundle/ResourceBundle/Controller/ResourceController.php b/src/CoreShop/Bundle/ResourceBundle/Controller/ResourceController.php index 7324b92eaa..7884bff3a7 100644 --- a/src/CoreShop/Bundle/ResourceBundle/Controller/ResourceController.php +++ b/src/CoreShop/Bundle/ResourceBundle/Controller/ResourceController.php @@ -18,6 +18,7 @@ namespace CoreShop\Bundle\ResourceBundle\Controller; use CoreShop\Bundle\ResourceBundle\Form\Helper\ErrorSerializer; +use CoreShop\Bundle\ResourceBundle\ResourcePermission; use CoreShop\Component\Resource\Factory\FactoryInterface; use CoreShop\Component\Resource\Metadata\MetadataInterface; use CoreShop\Component\Resource\Model\ResourceInterface; @@ -55,10 +56,10 @@ public function __construct( /** * @throws AccessDeniedException */ - protected function isGrantedOr403(): void + protected function isGrantedOr403(string $type): void { if ($this->metadata->hasParameter('permission')) { - $permission = sprintf('%s_permission_%s', $this->metadata->getApplicationName(), $this->metadata->getParameter('permission')); + $permission = sprintf('%s_permission_%s_%s', $this->metadata->getApplicationName(), $this->metadata->getParameter('permission'), $type); $user = $this->tokenStorage->getToken()?->getUser(); @@ -72,16 +73,20 @@ protected function isGrantedOr403(): void return; } + // Fallback to permission without type + // Todo: Remove in 5.0 + $permissionWithoutType = sprintf('%s_permission_%s', $this->metadata->getApplicationName(), $this->metadata->getParameter('permission')); + + if ($user->isAllowed($permissionWithoutType)) { + return; + } + throw new AccessDeniedException(); } } public function listAction(Request $request): JsonResponse { - $start = $request->query->get('start', 0); - $limit = $request->query->get('limit', 25); - - // TODO: use start and limit as soon as Admin UI has pagination $data = $this->repository->findAll(); return $this->viewHandler->handle($data, ['group' => 'List']); @@ -89,7 +94,7 @@ public function listAction(Request $request): JsonResponse public function getAction(Request $request): JsonResponse { - $this->isGrantedOr403(); + $this->isGrantedOr403(ResourcePermission::VIEW); $resources = $this->findOr404((int) $this->getParameterFromRequest($request, 'id')); @@ -98,7 +103,7 @@ public function getAction(Request $request): JsonResponse public function saveAction(Request $request): JsonResponse { - $this->isGrantedOr403(); + $this->isGrantedOr403(ResourcePermission::EDIT); $resource = $this->findOr404($this->getParameterFromRequest($request, 'id')); @@ -135,7 +140,7 @@ public function saveAction(Request $request): JsonResponse public function cloneAction(Request $request): JsonResponse { - $this->isGrantedOr403(); + $this->isGrantedOr403(ResourcePermission::EDIT); $resource = $this->factory->createNew(); $form = $this->resourceFormFactory->create($this->metadata, $resource); @@ -175,7 +180,7 @@ public function cloneAction(Request $request): JsonResponse public function addAction(Request $request): JsonResponse { - $this->isGrantedOr403(); + $this->isGrantedOr403(ResourcePermission::CREATE); $name = $this->getParameterFromRequest($request, 'name'); @@ -205,7 +210,7 @@ public function addAction(Request $request): JsonResponse public function deleteAction(Request $request): JsonResponse { - $this->isGrantedOr403(); + $this->isGrantedOr403(ResourcePermission::DELETE); $id = $this->getParameterFromRequest($request, 'id'); @@ -227,8 +232,6 @@ public function deleteAction(Request $request): JsonResponse public function folderConfigurationAction(): JsonResponse { - $this->isGrantedOr403(); - $repo = $this->repository; if (!$repo instanceof PimcoreRepositoryInterface) { diff --git a/src/CoreShop/Bundle/ResourceBundle/CoreShopResourceBundle.php b/src/CoreShop/Bundle/ResourceBundle/CoreShopResourceBundle.php index 0dbb96ad15..ddd3b0ddba 100644 --- a/src/CoreShop/Bundle/ResourceBundle/CoreShopResourceBundle.php +++ b/src/CoreShop/Bundle/ResourceBundle/CoreShopResourceBundle.php @@ -23,6 +23,7 @@ use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\RegisterPimcoreRepositoriesPass; use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\RegisterPimcoreResourcesPass; use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\RegisterResourcesPass; +use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\ResourcePermissionsPass; use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\StackClassesPass; use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\StackRepositoryPass; use CoreShop\Bundle\ResourceBundle\DependencyInjection\Compiler\ValidatorAutoMappingFixPass; @@ -60,6 +61,7 @@ public function build(ContainerBuilder $container): void $container->addCompilerPass(new StackRepositoryPass()); $container->addCompilerPass(new RegisterPimcoreRepositoriesPass()); $container->addCompilerPass(new ValidatorAutoMappingFixPass()); + $container->addCompilerPass(new ResourcePermissionsPass()); } public static function registerDependentBundles(BundleCollection $collection): void diff --git a/src/CoreShop/Bundle/ResourceBundle/DependencyInjection/Compiler/ResourcePermissionsPass.php b/src/CoreShop/Bundle/ResourceBundle/DependencyInjection/Compiler/ResourcePermissionsPass.php new file mode 100644 index 0000000000..53ac05ac2e --- /dev/null +++ b/src/CoreShop/Bundle/ResourceBundle/DependencyInjection/Compiler/ResourcePermissionsPass.php @@ -0,0 +1,87 @@ +getParameter('coreshop.resources'); + $globalParameter = 'coreshop.all.permissions'; + $globalPermissions = []; + + if ($container->hasParameter($globalParameter)) { + /** + * @var array $globalPermissions + */ + $globalPermissions = $container->getParameter($globalParameter); + } + + $permissions = []; + + foreach ($resources as $alias => $resourceConfig) { + [$applicationName, $name] = explode('.', $alias); + + if (!isset($resourceConfig['permission'])) { + continue; + } + + if (!isset($permissions[$applicationName])) { + $permissions[$applicationName] = []; + } + + $permission = $resourceConfig['permission']; + + foreach (ResourcePermission::getAllPermissions() as $type) { + $identifier = sprintf('%s_permission_%s_%s', $applicationName, $permission, $type); + + $permissions[$applicationName][$identifier] = true; + } + } + + foreach ($permissions as $applicationName => $appPermissions) { + $appPermissions = array_keys($appPermissions); + $applicationParameter = sprintf('%s.permissions', $applicationName); + $applicationPermissions = []; + + if ($container->hasParameter($applicationParameter)) { + /** + * @var array $applicationPermissions + */ + $applicationPermissions = $container->getParameter($applicationParameter); + } + + $container->setParameter($applicationParameter, [...$applicationPermissions, ...$appPermissions]); + + if (!isset($globalPermissions[$applicationName])) { + $globalPermissions[$applicationName] = []; + } + + $globalPermissions[$applicationName] = [ + ...$globalPermissions[$applicationName], + ...$appPermissions, + ]; + } + + $container->setParameter($globalParameter, $globalPermissions); + } +} diff --git a/src/CoreShop/Bundle/ResourceBundle/DependencyInjection/Extension/AbstractModelExtension.php b/src/CoreShop/Bundle/ResourceBundle/DependencyInjection/Extension/AbstractModelExtension.php index af5df55cf1..e2b0506f7b 100644 --- a/src/CoreShop/Bundle/ResourceBundle/DependencyInjection/Extension/AbstractModelExtension.php +++ b/src/CoreShop/Bundle/ResourceBundle/DependencyInjection/Extension/AbstractModelExtension.php @@ -20,6 +20,7 @@ use CoreShop\Bundle\PimcoreBundle\DependencyInjection\Extension\AbstractPimcoreExtension; use CoreShop\Bundle\ResourceBundle\CoreShopResourceBundle; use CoreShop\Bundle\ResourceBundle\DependencyInjection\Driver\DriverProvider; +use CoreShop\Bundle\ResourceBundle\ResourcePermission; use CoreShop\Component\Resource\Metadata\Metadata; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -150,50 +151,57 @@ protected function registerPimcoreResources($applicationName, $bundleResources, } } - if (array_key_exists('permissions', $bundleResources)) { - $applicationPermissions = []; - $applicationParameter = sprintf('%s.permissions', $applicationName); - $resourcePermissions = []; - $globalParameter = 'coreshop.all.permissions'; - $globalPermissions = []; - - if ($container->hasParameter($applicationParameter)) { - /** - * @var array $applicationPermissions - */ - $applicationPermissions = $container->getParameter($applicationParameter); - } + $applicationPermissions = []; + $applicationParameter = sprintf('%s.permissions', $applicationName); + $globalPermissions = []; + $globalParameter = 'coreshop.all.permissions'; - if ($container->hasParameter($globalParameter)) { - /** - * @var array $globalPermissions - */ - $globalPermissions = $container->getParameter($globalParameter); - } + if ($container->hasParameter($applicationParameter)) { + /** + * @var array $applicationPermissions + */ + $applicationPermissions = $container->getParameter($applicationParameter); + } - $permissions = []; + if ($container->hasParameter($globalParameter)) { + /** + * @var array $globalPermissions + */ + $globalPermissions = $container->getParameter($globalParameter); + } + + if (!isset($globalPermissions[$applicationName])) { + $globalPermissions[$applicationName] = []; + } + $permissions = []; + + if (array_key_exists('permissions', $bundleResources)) { foreach ($bundleResources['permissions'] as $permission) { $identifier = sprintf('%s_permission_%s', $applicationName, $permission); - $permissions[] = $identifier; - $resourcePermissions[] = $identifier; + $permissions[$identifier] = true; } + } - $globalApplicationPermissions = array_key_exists($applicationName, $globalPermissions) ? $globalPermissions[$applicationName] : []; - $globalApplicationPermissions = array_merge($globalApplicationPermissions, $resourcePermissions); - $globalPermissions[$applicationName] = $globalApplicationPermissions; + if (array_key_exists('resource_permissions', $bundleResources)) { + foreach ($bundleResources['resource_permissions'] as $permission) { + foreach (ResourcePermission::getAllPermissions() as $type) { + $identifier = sprintf('%s_permission_%s_%s', $applicationName, $permission, $type); - $container->setParameter($globalParameter, $globalPermissions); - $container->setParameter($applicationParameter, array_merge($applicationPermissions, $permissions)); + $permissions[$identifier] = true; + } + } } + + $applicationPermissions = array_merge($applicationPermissions, array_keys($permissions)); + $globalPermissions[$applicationName] = array_merge($globalPermissions[$applicationName], array_keys($permissions)); + + $container->setParameter($globalParameter, $globalPermissions); + $container->setParameter($applicationParameter, $applicationPermissions); } - /** - * @param string $applicationName - * @param array $bundles - */ - public function registerDependantBundles($applicationName, $bundles, ContainerBuilder $container): void + public function registerDependantBundles(string $applicationName, array $bundles, ContainerBuilder $container): void { $appParameterName = sprintf('%s.dependant.bundles', $applicationName); $globalParameterName = 'coreshop.all.dependant.bundles'; diff --git a/src/CoreShop/Bundle/ResourceBundle/ResourcePermission.php b/src/CoreShop/Bundle/ResourceBundle/ResourcePermission.php new file mode 100644 index 0000000000..e43f8d8055 --- /dev/null +++ b/src/CoreShop/Bundle/ResourceBundle/ResourcePermission.php @@ -0,0 +1,42 @@ +end() ->scalarNode('permissions') ->cannotBeOverwritten() - ->defaultValue(['carrier', 'shipping_rule']) + ->defaultValue([ + 'carrier_show', + 'carrier_list', + 'carrier_edit', + 'shipping_rule_show', + 'shipping_rule_list', + 'shipping_rule_edit', + ]) ->end() ->end() ->end() diff --git a/src/CoreShop/Bundle/ShippingBundle/Resources/public/pimcore/js/carrier/item.js b/src/CoreShop/Bundle/ShippingBundle/Resources/public/pimcore/js/carrier/item.js index 62aadb620c..228be35da9 100644 --- a/src/CoreShop/Bundle/ShippingBundle/Resources/public/pimcore/js/carrier/item.js +++ b/src/CoreShop/Bundle/ShippingBundle/Resources/public/pimcore/js/carrier/item.js @@ -35,6 +35,16 @@ coreshop.carrier.item = Class.create(coreshop.resource.item, { }, getPanel: function () { + const buttons = []; + + if (this.isAllowed('edit')) { + buttons.push({ + text: t('save'), + iconCls: 'pimcore_icon_save', + handler: this.save.bind(this) + }); + } + return new Ext.TabPanel({ activeTab: 0, title: this.data.identifier, @@ -42,11 +52,7 @@ coreshop.carrier.item = Class.create(coreshop.resource.item, { deferredRender: false, forceLayout: true, iconCls: this.iconCls, - buttons: [{ - text: t('save'), - iconCls: 'pimcore_icon_apply', - handler: this.save.bind(this) - }], + buttons: buttons, items: this.getItems() }); }, @@ -95,62 +101,60 @@ coreshop.carrier.item = Class.create(coreshop.resource.item, { this.logoSelect = this.getLogoSelect(); this.settingsForm = new Ext.form.Panel({ - iconCls: 'coreshop_icon_settings', - title: t('settings'), + disabled: !this.isAllowed('edit'), bodyStyle: 'padding:10px;', autoScroll: true, border: false, - items: [{ - xtype: 'fieldset', - autoHeight: true, - labelWidth: 350, - defaultType: 'textfield', - defaults: {width: '100%'}, - items: [ - { - xtype: 'textfield', - name: 'identifier', - fieldLabel: t('coreshop_identifier'), - value: data.identifier, - required: true - }, { - xtype: 'textfield', - name: 'trackingUrl', - fieldLabel: t('coreshop_carrier_trackingUrl'), - value: data.trackingUrl - }, - this.logoSelect.getLayoutEdit(), - { - xtype: 'tabpanel', - activeTab: 0, - defaults: { - autoHeight: true, - bodyStyle: 'padding:10px;' - }, - items: langTabs - }, - { - xtype: 'combo', - name: 'taxCalculationStrategy', - fieldLabel: t('coreshop_shipping_tax_calc_strategy'), - value: data.taxCalculationStrategy, - forceSelection: true, - queryMode: 'local', - valueField: 'value', - displayField: 'label', - store: pimcore.globalmanager.get('coreshop_shipping_tax_calculation_strategies') + items: [ + { + xtype: 'textfield', + name: 'identifier', + fieldLabel: t('coreshop_identifier'), + value: data.identifier, + required: true + }, { + xtype: 'textfield', + name: 'trackingUrl', + fieldLabel: t('coreshop_carrier_trackingUrl'), + value: data.trackingUrl + }, + this.logoSelect.getLayoutEdit(), + { + xtype: 'tabpanel', + activeTab: 0, + defaults: { + autoHeight: true, + bodyStyle: 'padding:10px;' }, - { - xtype: 'checkbox', - name: 'hideFromCheckout', - fieldLabel: t('coreshop_carrier_hideFromCheckout'), - value: this.data.hideFromCheckout - } - ] - }] + items: langTabs + }, + { + xtype: 'combo', + name: 'taxCalculationStrategy', + fieldLabel: t('coreshop_shipping_tax_calc_strategy'), + value: data.taxCalculationStrategy, + forceSelection: true, + queryMode: 'local', + valueField: 'value', + displayField: 'label', + store: pimcore.globalmanager.get('coreshop_shipping_tax_calculation_strategies') + }, + { + xtype: 'checkbox', + name: 'hideFromCheckout', + fieldLabel: t('coreshop_carrier_hideFromCheckout'), + value: this.data.hideFromCheckout + } + ] }); - return this.settingsForm; + return new Ext.Panel({ + iconCls: 'coreshop_icon_settings', + title: t('settings'), + autoScroll: true, + border: false, + items: [this.settingsForm] + }); }, getLogoSelect: function () { @@ -180,6 +184,7 @@ coreshop.carrier.item = Class.create(coreshop.resource.item, { }.bind(this)); this.shippingRuleGroupsGrid = Ext.create('Ext.grid.Panel', { + disabled: !this.isAllowed('edit'), columns: [ { header: t('coreshop_carriers_shipping_rule'), diff --git a/src/CoreShop/Bundle/ShippingBundle/Resources/public/pimcore/js/carrier/panel.js b/src/CoreShop/Bundle/ShippingBundle/Resources/public/pimcore/js/carrier/panel.js index 5db79cd64c..c12ac6eaf4 100644 --- a/src/CoreShop/Bundle/ShippingBundle/Resources/public/pimcore/js/carrier/panel.js +++ b/src/CoreShop/Bundle/ShippingBundle/Resources/public/pimcore/js/carrier/panel.js @@ -21,6 +21,7 @@ coreshop.carrier.panel = Class.create(coreshop.resource.panel, { storeId: 'coreshop_carriers', iconCls: 'coreshop_icon_carriers', type: 'coreshop_carriers', + permission: 'coreshop_permission_carrier', routing: { add: 'coreshop_carrier_add', diff --git a/src/CoreShop/Bundle/ShippingBundle/Resources/public/pimcore/js/shippingrule/item.js b/src/CoreShop/Bundle/ShippingBundle/Resources/public/pimcore/js/shippingrule/item.js index 4271d1efee..93f5891d81 100644 --- a/src/CoreShop/Bundle/ShippingBundle/Resources/public/pimcore/js/shippingrule/item.js +++ b/src/CoreShop/Bundle/ShippingBundle/Resources/public/pimcore/js/shippingrule/item.js @@ -23,8 +23,15 @@ coreshop.shippingrule.item = Class.create(coreshop.rules.item, { getPanel: function () { var items = this.getItems(); + const buttons = []; - //items.push(this.getUsedByPanel()); TODO!! + if (this.isAllowed('edit')) { + buttons.push({ + text: t('save'), + iconCls: 'pimcore_icon_save', + handler: this.save.bind(this) + }); + } this.panel = new Ext.TabPanel({ activeTab: 0, @@ -33,11 +40,7 @@ coreshop.shippingrule.item = Class.create(coreshop.rules.item, { deferredRender: false, forceLayout: true, iconCls: this.iconCls, - buttons: [{ - text: t('save'), - iconCls: 'pimcore_icon_apply', - handler: this.save.bind(this) - }], + buttons: buttons, items: items }); @@ -48,11 +51,10 @@ coreshop.shippingrule.item = Class.create(coreshop.rules.item, { var data = this.data; this.settingsForm = Ext.create('Ext.form.Panel', { - iconCls: 'coreshop_icon_settings', - title: t('settings'), bodyStyle: 'padding:10px;', autoScroll: true, border: false, + disabled: !this.isAllowed('edit'), items: [{ xtype: 'textfield', name: 'name', @@ -67,7 +69,13 @@ coreshop.shippingrule.item = Class.create(coreshop.rules.item, { }] }); - return this.settingsForm; + return new Ext.Panel({ + iconCls: 'coreshop_icon_settings', + title: t('settings'), + autoScroll: true, + border: false, + items: [this.settingsForm] + }); }, // // getUsedByPanel: function () { diff --git a/src/CoreShop/Bundle/ShippingBundle/Resources/public/pimcore/js/shippingrule/panel.js b/src/CoreShop/Bundle/ShippingBundle/Resources/public/pimcore/js/shippingrule/panel.js index 90becf18fa..5415d65c8d 100644 --- a/src/CoreShop/Bundle/ShippingBundle/Resources/public/pimcore/js/shippingrule/panel.js +++ b/src/CoreShop/Bundle/ShippingBundle/Resources/public/pimcore/js/shippingrule/panel.js @@ -20,6 +20,7 @@ coreshop.shippingrule.panel = Class.create(coreshop.rules.panel, { storeId: 'coreshop_carrier_shipping_rules', iconCls: 'coreshop_icon_carrier_shipping_rule', type: 'coreshop_carriers_shipping_rules', + permission: 'coreshop_permission_shipping_rule', routing: { add: 'coreshop_shipping_rule_add', diff --git a/src/CoreShop/Bundle/ShippingBundle/Resources/translations/admin.de.yml b/src/CoreShop/Bundle/ShippingBundle/Resources/translations/admin.de.yml index 435bf0c37b..805a0d3108 100644 --- a/src/CoreShop/Bundle/ShippingBundle/Resources/translations/admin.de.yml +++ b/src/CoreShop/Bundle/ShippingBundle/Resources/translations/admin.de.yml @@ -23,8 +23,16 @@ coreshop_condition_postcodes_exclusion: 'Ausschließend' coreshop_condition_postcodes_info: 'Sie können mehrere Postleitzahlen getrennt mit einem "," einfügen. Sie können ebenfalls Bereiche zB 46-49 oder WR1-WR5 definieren.' coreshop_condition_shippingRule: 'Versandregel' coreshop_action_shippingRule: 'Versandregel' -coreshop_permission_carrier: 'CoreShop: Versanddienst' -coreshop_permission_shipping_rule: 'CoreShop: Versandregel' +coreshop_permission_carrier_list: 'CoreShop: Versanddienst Liste' +coreshop_permission_carrier_create: 'CoreShop: Versanddienst erstellen' +coreshop_permission_carrier_edit: 'CoreShop: Versanddienst bearbeiten' +coreshop_permission_carrier_delete: 'CoreShop: Versanddienst löschen' +coreshop_permission_carrier_view: 'CoreShop: Versanddienst ansehen' +coreshop_permission_shipping_rule_list: 'CoreShop: Versandregel Liste' +coreshop_permission_shipping_rule_create: 'CoreShop: Versandregel erstellen' +coreshop_permission_shipping_rule_edit: 'CoreShop: Versandregel bearbeiten' +coreshop_permission_shipping_rule_delete: 'CoreShop: Versandregel löschen' +coreshop_permission_shipping_rule_view: 'CoreShop: Versandregel ansehen' coreshop_condition_weight: 'Gewicht' coreshop_condition_dimension: 'Dimension' coreshop_action_additionAmount: 'Aufschlag Menge' diff --git a/src/CoreShop/Bundle/ShippingBundle/Resources/translations/admin.en.yml b/src/CoreShop/Bundle/ShippingBundle/Resources/translations/admin.en.yml index db4e1dcca3..90dfb4b514 100644 --- a/src/CoreShop/Bundle/ShippingBundle/Resources/translations/admin.en.yml +++ b/src/CoreShop/Bundle/ShippingBundle/Resources/translations/admin.en.yml @@ -22,8 +22,16 @@ coreshop_condition_postcodes_exclusion: 'Exclusion' coreshop_condition_postcodes_info: 'You can add multiple postcodes using CSV format. You can also define Ranges. For example 46-49 or WR1-WR5.' coreshop_condition_shippingRule: 'Shipping Rule' coreshop_action_shippingRule: 'Shipping Rule' -coreshop_permission_carrier: 'CoreShop: Carrier' -coreshop_permission_shipping_rule: 'CoreShop: Shipping Rule' +coreshop_permission_carrier_list: 'CoreShop Carrier: Carrier' +coreshop_permission_carrier_create: 'CoreShop Carrier: Create' +coreshop_permission_carrier_edit: 'CoreShop Carrier: Edit' +coreshop_permission_carrier_delete: 'CoreShop Carrier: Delete' +coreshop_permission_carrier_view: 'CoreShop Carrier: View' +coreshop_permission_shipping_rule_list: 'CoreShop Shipping Rule: List' +coreshop_permission_shipping_rule_create: 'CoreShop Shipping Rule: Create' +coreshop_permission_shipping_rule_edit: 'CoreShop Shipping Rule: Edit' +coreshop_permission_shipping_rule_delete: 'CoreShop Shipping Rule: Delete' +coreshop_permission_shipping_rule_view: 'CoreShop Shipping Rule: View' coreshop_condition_weight: 'Weight' coreshop_condition_dimension: 'Dimension' coreshop_action_additionAmount: 'Addition Amount' diff --git a/src/CoreShop/Bundle/ShippingBundle/Resources/translations/admin.it.yml b/src/CoreShop/Bundle/ShippingBundle/Resources/translations/admin.it.yml index e64185ce27..ae8f419e94 100644 --- a/src/CoreShop/Bundle/ShippingBundle/Resources/translations/admin.it.yml +++ b/src/CoreShop/Bundle/ShippingBundle/Resources/translations/admin.it.yml @@ -23,7 +23,6 @@ coreshop_condition_postcodes_exclusion: 'Esclusione' coreshop_condition_postcodes_info: 'Puoi aggiungere più codici postali usando il formato CSV. Puoi anche definire gli intervalli. Per esempio 46-49 o WR1-WR5.' coreshop_condition_shippingRule: 'Regola di spedizione' coreshop_action_shippingRule: 'Regola di spedizione' -coreshop_permission_carrier: 'CoreShop: Vettore' coreshop_permission_shipping_rule: 'CoreShop: Regola di spedizione' coreshop_condition_weight: 'Peso' coreshop_condition_dimension: 'Dimensione' diff --git a/src/CoreShop/Bundle/ShippingBundle/Resources/translations/admin.sv.yml b/src/CoreShop/Bundle/ShippingBundle/Resources/translations/admin.sv.yml index 59a58e1dc6..23754d6dec 100644 --- a/src/CoreShop/Bundle/ShippingBundle/Resources/translations/admin.sv.yml +++ b/src/CoreShop/Bundle/ShippingBundle/Resources/translations/admin.sv.yml @@ -8,6 +8,5 @@ coreshop_carrier: 'Transportör' coreshop_condition_postcodes: 'Postnummer' coreshop_condition_postcodes_exclusion: 'Undantag' coreshop_condition_postcodes_info: 'Du kan lägga till flera postnummer med CSV-format. Du kan också definiera Områden. Till exempel 46-49 eller WR1-WR5.' -coreshop_permission_carrier: 'CoreShop: Transportör' coreshop_action_additionAmount: 'Tillägg Belopp' coreshop_action_additionPercent: 'Tillägg Procent' diff --git a/src/CoreShop/Bundle/StoreBundle/DependencyInjection/Configuration.php b/src/CoreShop/Bundle/StoreBundle/DependencyInjection/Configuration.php index 9e4767465e..300574a624 100644 --- a/src/CoreShop/Bundle/StoreBundle/DependencyInjection/Configuration.php +++ b/src/CoreShop/Bundle/StoreBundle/DependencyInjection/Configuration.php @@ -106,7 +106,7 @@ private function addPimcoreResourcesSection(ArrayNodeDefinition $node): void ->end() ->scalarNode('permissions') ->cannotBeOverwritten() - ->defaultValue(['store']) + ->defaultValue([]) ->end() ->end() ->end() diff --git a/src/CoreShop/Bundle/StoreBundle/Resources/public/pimcore/js/item.js b/src/CoreShop/Bundle/StoreBundle/Resources/public/pimcore/js/item.js index a5d5e2f388..195f561e40 100644 --- a/src/CoreShop/Bundle/StoreBundle/Resources/public/pimcore/js/item.js +++ b/src/CoreShop/Bundle/StoreBundle/Resources/public/pimcore/js/item.js @@ -20,11 +20,7 @@ coreshop.store.item = Class.create(coreshop.resource.item, { save: 'coreshop_store_save' }, - getItems: function () { - return [this.getFormPanel()]; - }, - - getFormPanel: function () { + getFormPanelItems: function () { this.store = new Ext.data.Store({ restful: false, idProperty: 'id', @@ -40,65 +36,44 @@ coreshop.store.item = Class.create(coreshop.resource.item, { this.store.load(); - this.formPanel = new Ext.form.Panel({ - bodyStyle: 'padding:20px 5px 20px 5px;', - border: false, - region: 'center', - autoScroll: true, - forceLayout: true, - defaults: { - forceLayout: true - }, - buttons: [ - { - text: t('save'), - handler: this.save.bind(this), - iconCls: 'pimcore_icon_apply' - } - ], + return [{ + xtype: 'fieldset', + autoHeight: true, + labelWidth: 250, + defaultType: 'textfield', + defaults: {width: 300}, items: [ { - xtype: 'fieldset', - autoHeight: true, - labelWidth: 250, - defaultType: 'textfield', - defaults: {width: 300}, - items: [ - { - fieldLabel: t('name'), - name: 'name', - value: this.data.name - }, - { - fieldLabel: t('coreshop_store_site'), - xtype: 'combo', - name: 'siteId', - width: 400, - store: this.store, - displayField: 'name', - valueField: 'id', - triggerAction: 'all', - typeAhead: false, - editable: false, - forceSelection: true, - queryMode: 'local', - value: this.data.siteId - }, - { - fieldLabel: t('coreshop_store_template'), - name: 'template', - value: this.data.template - }, - { - xtype: 'coreshop.currency', - value: this.data.currency - }, - ] - } + fieldLabel: t('name'), + name: 'name', + value: this.data.name + }, + { + fieldLabel: t('coreshop_store_site'), + xtype: 'combo', + name: 'siteId', + width: 400, + store: this.store, + displayField: 'name', + valueField: 'id', + triggerAction: 'all', + typeAhead: false, + editable: false, + forceSelection: true, + queryMode: 'local', + value: this.data.siteId + }, + { + fieldLabel: t('coreshop_store_template'), + name: 'template', + value: this.data.template + }, + { + xtype: 'coreshop.currency', + value: this.data.currency + }, ] - }); - - return this.formPanel; + }]; }, getSaveData: function () { diff --git a/src/CoreShop/Bundle/StoreBundle/Resources/public/pimcore/js/panel.js b/src/CoreShop/Bundle/StoreBundle/Resources/public/pimcore/js/panel.js index 8dc6c18a11..d21044f596 100644 --- a/src/CoreShop/Bundle/StoreBundle/Resources/public/pimcore/js/panel.js +++ b/src/CoreShop/Bundle/StoreBundle/Resources/public/pimcore/js/panel.js @@ -21,6 +21,7 @@ coreshop.store.panel = Class.create(coreshop.resource.panel, { storeId: 'coreshop_stores', iconCls: 'coreshop_icon_store', type: 'coreshop_stores', + permission: 'coreshop_permission_store', routing: { add: 'coreshop_store_add', diff --git a/src/CoreShop/Bundle/StoreBundle/Resources/translations/admin.de.yml b/src/CoreShop/Bundle/StoreBundle/Resources/translations/admin.de.yml index e2863e50b0..64e3a75b22 100644 --- a/src/CoreShop/Bundle/StoreBundle/Resources/translations/admin.de.yml +++ b/src/CoreShop/Bundle/StoreBundle/Resources/translations/admin.de.yml @@ -3,5 +3,9 @@ coreshop_store: 'Store' coreshop_store_multiselect: 'Store Mehrfachauswahl' coreshop_store_site: 'Seite' coreshop_store_template: 'Template' -coreshop_permission_store: 'CoreShop: Store' +coreshop_permission_store_list: 'CoreShop: Store Liste' +coreshop_permission_store_create: 'CoreShop: Store erstellen' +coreshop_permission_store_edit: 'CoreShop: Store bearbeiten' +coreshop_permission_store_delete: 'CoreShop: Store löschen' +coreshop_permission_store_view: 'CoreShop: Store ansehen' coreshop_stores: 'Stores' diff --git a/src/CoreShop/Bundle/StoreBundle/Resources/translations/admin.en.yml b/src/CoreShop/Bundle/StoreBundle/Resources/translations/admin.en.yml index 424629ae10..efb8637651 100644 --- a/src/CoreShop/Bundle/StoreBundle/Resources/translations/admin.en.yml +++ b/src/CoreShop/Bundle/StoreBundle/Resources/translations/admin.en.yml @@ -2,5 +2,9 @@ coreshop_store: 'Store' coreshop_store_multiselect: 'Store Multiselect' coreshop_store_site: 'Site' coreshop_store_template: 'Template' -coreshop_permission_store: 'CoreShop: Store' +coreshop_permission_store_list: 'CoreShop Store: List' +coreshop_permission_store_create: 'CoreShop Store: Create' +coreshop_permission_store_edit: 'CoreShop Store: Edit' +coreshop_permission_store_delete: 'CoreShop Store: Delete' +coreshop_permission_store_view: 'CoreShop Store: View' coreshop_stores: 'Stores' diff --git a/src/CoreShop/Bundle/StoreBundle/Resources/translations/admin.it.yml b/src/CoreShop/Bundle/StoreBundle/Resources/translations/admin.it.yml index e8e447780a..93ed22667a 100644 --- a/src/CoreShop/Bundle/StoreBundle/Resources/translations/admin.it.yml +++ b/src/CoreShop/Bundle/StoreBundle/Resources/translations/admin.it.yml @@ -3,5 +3,4 @@ coreshop_store: 'Negozio' coreshop_store_multiselect: 'Negozio multiselezione' coreshop_store_site: 'Sito' coreshop_store_template: 'Template' -coreshop_permission_store: 'CoreShop: Negozio' coreshop_stores: 'Negozi' diff --git a/src/CoreShop/Bundle/TaxationBundle/DependencyInjection/Configuration.php b/src/CoreShop/Bundle/TaxationBundle/DependencyInjection/Configuration.php index 8bcf5e1fc6..a1db4ac2c9 100644 --- a/src/CoreShop/Bundle/TaxationBundle/DependencyInjection/Configuration.php +++ b/src/CoreShop/Bundle/TaxationBundle/DependencyInjection/Configuration.php @@ -183,7 +183,7 @@ private function addPimcoreResourcesSection(ArrayNodeDefinition $node): void ->end() ->scalarNode('permissions') ->cannotBeOverwritten() - ->defaultValue(['tax_rate', 'tax_rule_group']) + ->defaultValue([]) ->end() ->end() ->end() diff --git a/src/CoreShop/Bundle/TaxationBundle/Resources/public/pimcore/js/tax/item.js b/src/CoreShop/Bundle/TaxationBundle/Resources/public/pimcore/js/tax/item.js index 4ef3c62197..7c415459e9 100644 --- a/src/CoreShop/Bundle/TaxationBundle/Resources/public/pimcore/js/tax/item.js +++ b/src/CoreShop/Bundle/TaxationBundle/Resources/public/pimcore/js/tax/item.js @@ -20,15 +20,11 @@ coreshop.tax.item = Class.create(coreshop.resource.item, { save: 'coreshop_tax_rate_save' }, - getItems: function () { - return [this.getFormPanel()]; - }, - getTitleText: function () { return this.data.name; }, - getFormPanel: function () { + getFormPanelItems: function () { var data = this.data; var langTabs = []; @@ -49,60 +45,39 @@ coreshop.tax.item = Class.create(coreshop.resource.item, { langTabs.push(tab); }); - this.formPanel = new Ext.form.Panel({ - bodyStyle: 'padding:20px 5px 20px 5px;', - border: false, - region: 'center', - autoScroll: true, - forceLayout: true, - defaults: { - forceLayout: true - }, - buttons: [ - { - text: t('save'), - handler: this.save.bind(this), - iconCls: 'pimcore_icon_apply' - } - ], + return [{ + xtype: 'fieldset', + autoHeight: true, + labelWidth: 350, + defaultType: 'textfield', + defaults: {width: '100%'}, items: [ { - xtype: 'fieldset', - autoHeight: true, - labelWidth: 350, - defaultType: 'textfield', - defaults: {width: '100%'}, - items: [ - { - xtype: 'tabpanel', - activeTab: 0, - defaults: { - autoHeight: true, - bodyStyle: 'padding:10px;' - }, - items: langTabs - }, - { - xtype: 'numberfield', - name: 'rate', - fieldLabel: t('coreshop_tax_rate'), - width: 400, - value: data.rate, - decimalPrecision: 2, - step: 1 - }, { - xtype: 'checkbox', - name: 'active', - fieldLabel: t('active'), - width: 250, - checked: data.active - } - ] + xtype: 'tabpanel', + activeTab: 0, + defaults: { + autoHeight: true, + bodyStyle: 'padding:10px;' + }, + items: langTabs + }, + { + xtype: 'numberfield', + name: 'rate', + fieldLabel: t('coreshop_tax_rate'), + width: 400, + value: data.rate, + decimalPrecision: 2, + step: 1 + }, { + xtype: 'checkbox', + name: 'active', + fieldLabel: t('active'), + width: 250, + checked: data.active } ] - }); - - return this.formPanel; + }]; }, getSaveData: function () { diff --git a/src/CoreShop/Bundle/TaxationBundle/Resources/public/pimcore/js/tax/panel.js b/src/CoreShop/Bundle/TaxationBundle/Resources/public/pimcore/js/tax/panel.js index 4a343cf76c..5d1c4fcc6d 100644 --- a/src/CoreShop/Bundle/TaxationBundle/Resources/public/pimcore/js/tax/panel.js +++ b/src/CoreShop/Bundle/TaxationBundle/Resources/public/pimcore/js/tax/panel.js @@ -21,6 +21,7 @@ coreshop.tax.panel = Class.create(coreshop.resource.panel, { storeId: 'coreshop_tax_rates', iconCls: 'coreshop_icon_taxes', type: 'coreshop_taxes', + permission: 'coreshop_permission_tax_rate', routing: { add: 'coreshop_tax_rate_add', diff --git a/src/CoreShop/Bundle/TaxationBundle/Resources/public/pimcore/js/taxrulegroup/item.js b/src/CoreShop/Bundle/TaxationBundle/Resources/public/pimcore/js/taxrulegroup/item.js index f393a04bd8..2dd376f8a0 100644 --- a/src/CoreShop/Bundle/TaxationBundle/Resources/public/pimcore/js/taxrulegroup/item.js +++ b/src/CoreShop/Bundle/TaxationBundle/Resources/public/pimcore/js/taxrulegroup/item.js @@ -20,11 +20,7 @@ coreshop.taxrulegroup.item = Class.create(coreshop.resource.item, { save: 'coreshop_tax_rule_group_save' }, - getItems: function () { - return [this.getFormPanel()]; - }, - - getFormPanel: function () { + getFormPanelItems: function () { var data = this.data; var items = [ @@ -41,36 +37,17 @@ coreshop.taxrulegroup.item = Class.create(coreshop.resource.item, { } ]; - this.formPanel = new Ext.form.Panel({ - bodyStyle: 'padding:20px 5px 20px 5px;', - border: false, - region: 'center', - autoScroll: true, - forceLayout: true, - defaults: { - forceLayout: true + return [ + { + xtype: 'fieldset', + autoHeight: true, + labelWidth: 350, + defaultType: 'textfield', + defaults: {width: 400}, + items: items }, - buttons: [ - { - text: t('save'), - handler: this.save.bind(this), - iconCls: 'pimcore_icon_apply' - } - ], - items: [ - { - xtype: 'fieldset', - autoHeight: true, - labelWidth: 350, - defaultType: 'textfield', - defaults: {width: 400}, - items: items - }, - this.getGrid() - ] - }); - - return this.formPanel; + this.getGrid() + ]; }, getGrid: function () { diff --git a/src/CoreShop/Bundle/TaxationBundle/Resources/public/pimcore/js/taxrulegroup/panel.js b/src/CoreShop/Bundle/TaxationBundle/Resources/public/pimcore/js/taxrulegroup/panel.js index eb23b6d1b6..cac6e27be2 100644 --- a/src/CoreShop/Bundle/TaxationBundle/Resources/public/pimcore/js/taxrulegroup/panel.js +++ b/src/CoreShop/Bundle/TaxationBundle/Resources/public/pimcore/js/taxrulegroup/panel.js @@ -21,6 +21,7 @@ coreshop.taxrulegroup.panel = Class.create(coreshop.resource.panel, { storeId: 'coreshop_taxrulegroups', iconCls: 'coreshop_icon_tax_rule_groups', type: 'coreshop_taxrulegroups', + permission: 'coreshop_permission_tax_rule_group', routing: { add: 'coreshop_tax_rule_group_add', diff --git a/src/CoreShop/Bundle/TaxationBundle/Resources/translations/admin.de.yml b/src/CoreShop/Bundle/TaxationBundle/Resources/translations/admin.de.yml index 9baf51eee9..20aa26b11b 100644 --- a/src/CoreShop/Bundle/TaxationBundle/Resources/translations/admin.de.yml +++ b/src/CoreShop/Bundle/TaxationBundle/Resources/translations/admin.de.yml @@ -6,5 +6,13 @@ coreshop_tax_rule_behavior_combine: 'Kombinieren' coreshop_tax_rule_behavior_on_after_another: 'Eine nach der anderen' coreshop_tax_rule_behavior: 'Verhalten' coreshop_all: 'Alle' -coreshop_permission_tax_rate: 'CoreShop: Steuerrate' -coreshop_permission_tax_rule_group: 'CoreShop: Steuerregel' +coreshop_permission_tax_rate_list: 'CoreShop: Steuerraten Liste' +coreshop_permission_tax_rate_create: 'CoreShop: Steuerrate erstellen' +coreshop_permission_tax_rate_edit: 'CoreShop: Steuerrate bearbeiten' +coreshop_permission_tax_rate_delete: 'CoreShop: Steuerrate löschen' +coreshop_permission_tax_rate_view: 'CoreShop: Steuerrate ansehen' +coreshop_permission_tax_rule_group_list: 'CoreShop: Steuerregel Liste' +coreshop_permission_tax_rule_group_create: 'CoreShop: Steuerregel erstellen' +coreshop_permission_tax_rule_group_edit: 'CoreShop: Steuerregel bearbeiten' +coreshop_permission_tax_rule_group_delete: 'CoreShop: Steuerregel löschen' +coreshop_permission_tax_rule_group_view: 'CoreShop: Steuerregel ansehen' diff --git a/src/CoreShop/Bundle/TaxationBundle/Resources/translations/admin.en.yml b/src/CoreShop/Bundle/TaxationBundle/Resources/translations/admin.en.yml index 506aac8478..d5c0b64a97 100644 --- a/src/CoreShop/Bundle/TaxationBundle/Resources/translations/admin.en.yml +++ b/src/CoreShop/Bundle/TaxationBundle/Resources/translations/admin.en.yml @@ -5,5 +5,13 @@ coreshop_tax_rule_behavior_combine: 'Combine' coreshop_tax_rule_behavior_on_after_another: 'One after another' coreshop_tax_rule_behavior: 'Behavior' coreshop_all: 'All' -coreshop_permission_tax_rate: 'CoreShop: Tax Rate' -coreshop_permission_tax_rule_group: 'CoreShop: Tax Rule' +coreshop_permission_tax_rate_list: 'CoreShop Tax Rate: List' +coreshop_permission_tax_rate_create: 'CoreShop Tax Rate: Create' +coreshop_permission_tax_rate_edit: 'CoreShop Tax Rate: Edit' +coreshop_permission_tax_rate_delete: 'CoreShop Tax Rate: Delete' +coreshop_permission_tax_rate_view: 'CoreShop Tax Rate: View' +coreshop_permission_tax_rule_group_list: 'CoreShop Tax Rule Group: List' +coreshop_permission_tax_rule_group_create: 'CoreShop Tax Rule Group: Create' +coreshop_permission_tax_rule_group_edit: 'CoreShop Tax Rule Group: Edit' +coreshop_permission_tax_rule_group_delete: 'CoreShop Tax Rule Group: Delete' +coreshop_permission_tax_rule_group_view: 'CoreShop Tax Rule Group: View' diff --git a/src/CoreShop/Bundle/TaxationBundle/Resources/translations/admin.sv.yml b/src/CoreShop/Bundle/TaxationBundle/Resources/translations/admin.sv.yml index cdf06236ab..1b61bdd7c4 100644 --- a/src/CoreShop/Bundle/TaxationBundle/Resources/translations/admin.sv.yml +++ b/src/CoreShop/Bundle/TaxationBundle/Resources/translations/admin.sv.yml @@ -6,5 +6,3 @@ coreshop_tax_rule_behavior_combine: 'Kombinera' coreshop_tax_rule_behavior_on_after_another: 'En efter en' coreshop_tax_rule_behavior: 'Beteende' coreshop_all: 'Alla' -coreshop_permission_tax_rate: 'CoreShop: Skattesats' -coreshop_permission_tax_rule_group: 'CoreShop: Skatt-regel'