Skip to content

Commit

Permalink
Merge pull request #394 from dpfaffenbauer/issue/writable
Browse files Browse the repository at this point in the history
[Writable] only allow writable definitions to be saved
  • Loading branch information
dpfaffenbauer committed Oct 2, 2023
2 parents 443af0b + 79370b5 commit a6a33ce
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
Expand Up @@ -24,7 +24,6 @@ class PimcoreSettingsListener
{
public function indexSettings(IndexActionSettingsEvent $settingsEvent): void
{
$settingsEvent->addSetting('data-definitions-import-definition-writeable', (new ImportDefinition())->isWriteable());
$settingsEvent->addSetting('data-definitions-export-definition-writeable', (new ExportDefinition())->isWriteable());

}
}
Expand Up @@ -14,3 +14,8 @@ Wvision\Bundle\DataDefinitionsBundle\Model\ExportDefinition:
expose: true
type: boolean
groups: [ Detailed ]
virtual_properties:
isWriteable:
exp: object.isWriteable()
type: boolean
serialized_name: isWriteable
Expand Up @@ -50,3 +50,8 @@ Wvision\Bundle\DataDefinitionsBundle\Model\ImportDefinition:
expose: true
type: boolean
groups: [ Detailed ]
virtual_properties:
isWriteable:
exp: object.isWriteable()
type: boolean
serialized_name: isWriteable
Expand Up @@ -25,7 +25,7 @@ pimcore.plugin.datadefinitions.export.item = Class.create(pimcore.plugin.datadef
providers: [],

saveDisabled: function () {
return !pimcore.settings['data-definitions-export-definition-writeable'];
return !this.data.isWriteable;
},

getSettings: function () {
Expand Down
Expand Up @@ -26,7 +26,7 @@ pimcore.plugin.datadefinitions.import.item = Class.create(pimcore.plugin.datadef
providers: [],

saveDisabled: function () {
return !pimcore.settings['data-definitions-import-definition-writeable'];
return !this.data.isWriteable;
},

getSettings: function () {
Expand Down

0 comments on commit a6a33ce

Please sign in to comment.