diff --git a/bin/Site/Area.js b/bin/Site/Area.js index 1bf28d15e364250585beaea25e4dfe7085a22f77..fbd1c642f29731f36dfdd2380c4d9fc5e7929809 100644 --- a/bin/Site/Area.js +++ b/bin/Site/Area.js @@ -225,7 +225,7 @@ define('package/quiqqer/bricks/bin/Site/Area', [ events : { onClick : function() { - Elm.destroy(); + self.openBrickDeleteDialog( Elm ); } } }).inject( Elm ); @@ -315,6 +315,29 @@ define('package/quiqqer/bricks/bin/Site/Area', [ }).open(); }, + /** + * Opens the brick deletion dialog + * + * @param {HTMLElement} BrickElement - Element of the Brick + */ + openBrickDeleteDialog : function(BrickElement) + { + new QUIConfirm({ + title : 'Baustein löschen?', + icon : 'icon-remove', + text : 'Baustein wirklich löschen?', + information : 'Möchten Sie den Baustein für diese Seite wirklich löschen?', + maxHeight : 300, + maxWidth : 500, + events : + { + onSubmit : function() { + BrickElement.destroy(); + } + } + }).open(); + }, + /** * Opens the brick settings dialog * diff --git a/lib/QUI/Bricks/Events.php b/lib/QUI/Bricks/Events.php index 133bb85a5e948cd92838905e29b60a9119b6a336..9c9416768510f01d1e42bc46976362d96bd25383 100644 --- a/lib/QUI/Bricks/Events.php +++ b/lib/QUI/Bricks/Events.php @@ -25,6 +25,9 @@ class Events */ static function onSiteSave($Site) { + QUI\Rights\Permission::checkPermission('quiqqer.blocks.assign'); + + $areas = $Site->getAttribute( 'quiqqer.bricks.areas' ); $areas = json_decode( $areas, true ); diff --git a/lib/QUI/Bricks/Manager.php b/lib/QUI/Bricks/Manager.php index 35428d9764da3dd37acb301020400878d7f99163..8c59e2a1392834cbd8fdbfbd8e255e17150285fd 100644 --- a/lib/QUI/Bricks/Manager.php +++ b/lib/QUI/Bricks/Manager.php @@ -38,6 +38,9 @@ class Manager */ public function createBrickForProject(Project $Project, Brick $Brick) { + QUI\Rights\Permission::checkPermission( 'quiqqer.blocks.create' ); + + QUI::getDataBase()->insert( $this->_getTable(), array( @@ -69,6 +72,8 @@ public function clearCache() */ public function deleteBrick($brickId) { + QUI\Rights\Permission::checkPermission( 'quiqqer.blocks.delete' ); + // check if brick exist $this->getBrickById( $brickId ); @@ -338,6 +343,8 @@ public function getBricksFromProject(Project $Project) */ public function saveBrick($brickId, array $brickData) { + QUI\Rights\Permission::checkPermission( 'quiqqer.blocks.edit' ); + $Brick = $this->getBrickById( $brickId ); $areas = array(); $areaString = ''; diff --git a/locale.xml b/locale.xml index 0f6830899ea51878bf1a73b7f571339951d3117d..b3924ca96aeb4d0f5471dfa88226c5d4bc3a2c91 100644 --- a/locale.xml +++ b/locale.xml @@ -42,10 +42,36 @@ <de><![CDATA[Blöcke]]></de> <en><![CDATA[Bricks]]></en> </locale> + </groups> <groups name="quiqqer/bricks" datatype="js"> </groups> + <!-- permissions locale --> + <groups name="locale/permissions" datatype="php,js"> + <locale name="quiqqer.blocks._title"> + <de><![CDATA[Bausteine]]></de> + <en><![CDATA[Bricks]]></en> + </locale> + + <locale name="quiqqer.blocks.edit._title"> + <de><![CDATA[Darf Bausteine bearbeiten / editieren.]]></de> + <en><![CDATA[Can edit Bricks.]]></en> + </locale> + <locale name="quiqqer.blocks.assign._title"> + <de><![CDATA[Darf Bausteine Seiten zu weisen.]]></de> + <en><![CDATA[Can assign Bricks to Sites.]]></en> + </locale> + <locale name="quiqqer.blocks.delete._title"> + <de><![CDATA[Darf Bausteine löschen.]]></de> + <en><![CDATA[Can delete Bricks.]]></en> + </locale> + <locale name="quiqqer.blocks.create._title"> + <de><![CDATA[Darf neue Bausteine erstellen.]]></de> + <en><![CDATA[Can create new Bricks.]]></en> + </locale> + </groups> + </locales> diff --git a/permissions.xml b/permissions.xml new file mode 100644 index 0000000000000000000000000000000000000000..fe32733c54329ac006f3cc638878d3938e083e16 --- /dev/null +++ b/permissions.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<permissions> + + <permission name="quiqqer.blocks.create" type="bool"> + <defaultvalue>1</defaultvalue> + </permission> + <permission name="quiqqer.blocks.edit" type="bool"> + <defaultvalue>1</defaultvalue> + </permission> + <permission name="quiqqer.blocks.delete" type="bool"> + <defaultvalue>1</defaultvalue> + </permission> + <permission name="quiqqer.blocks.assign" type="bool"> + <defaultvalue>1</defaultvalue> + </permission> + +</permissions>