Implement permission checks.

This commit is contained in:
David Molineus
2018-12-05 14:05:01 +01:00
parent f2959b2df0
commit fa1ceb9402
8 changed files with 508 additions and 55 deletions
@@ -51,6 +51,8 @@ services:
- '@netzmacht.contao_toolkit.repository_manager'
- '@translator'
- '@netzmacht.contao_leaflet.layer_label_renderer'
- '@netzmacht.contao_toolkit.contao.backend_user'
- '@netzmacht.contao_toolkit.dca.listeners.state_button_callback'
- '@netzmacht.contao_toolkit.contao.backend_adapter'
- '%netzmacht.contao_leaflet.layers%'
- '%netzmacht.contao_leaflet.providers%'
@@ -63,6 +65,7 @@ services:
arguments:
- '@database_connection'
- '@netzmacht.contao_toolkit.repository_manager'
- '@netzmacht.contao_toolkit.contao.backend_user'
netzmacht.contao_leaflet.listeners.dca.vector:
class: Netzmacht\Contao\Leaflet\Listener\Dca\VectorDcaListener
@@ -70,6 +73,7 @@ services:
arguments:
- '@netzmacht.contao_toolkit.dca.manager'
- '@netzmacht.contao_toolkit.repository_manager'
- '@netzmacht.contao_toolkit.contao.backend_user'
- '%netzmacht.contao_leaflet.vectors%'
netzmacht.contao_leaflet.listeners.dca.icon:
@@ -17,9 +17,6 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
'dataContainer' => 'Table',
'enableVersioning' => true,
'ctable' => ['tl_leaflet_vector', 'tl_leaflet_marker'],
'ondelete_callback' => [
['netzmacht.contao_leaflet.listeners.dca.layer', 'deleteRelations'],
],
'sql' => [
'keys' => [
'id' => 'primary',
@@ -28,8 +25,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
],
],
'onload_callback' => [
['netzmacht.contao_leaflet.listeners.dca.layer', 'checkPermissions'],
['netzmacht.contao_leaflet.listeners.dca.leaflet', 'loadLanguageFile'],
],
'ondelete_callback' => [
['netzmacht.contao_leaflet.listeners.dca.layer', 'deleteRelations'],
],
'onsubmit_callback' => [
['netzmacht.contao_leaflet.listeners.dca.leaflet', 'clearCache'],
],
@@ -91,27 +92,31 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
'button_callback' => ['netzmacht.contao_leaflet.listeners.dca.layer', 'generateVectorsButton'],
],
'edit' => [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['edit'],
'href' => 'act=edit',
'icon' => 'header.gif',
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['edit'],
'href' => 'act=edit',
'icon' => 'header.gif',
'button_callback' => ['netzmacht.contao_leaflet.listeners.dca.layer', 'generateEditButton'],
],
'copy' => [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['copy'],
'href' => 'act=copy',
'icon' => 'copy.gif',
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['copy'],
'href' => 'act=copy',
'icon' => 'copy.gif',
'button_callback' => ['netzmacht.contao_leaflet.listeners.dca.layer', 'generateCopyButton'],
],
'cut' => [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['cut'],
'href' => 'act=paste&mode=cut',
'icon' => 'cut.gif',
'attributes' => 'onclick="Backend.getScrollOffset()"',
'button_callback' => ['netzmacht.contao_leaflet.listeners.dca.layer', 'generateEditButton'],
],
'delete' => [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm']
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm']
. '\'))return false;Backend.getScrollOffset()"',
'button_callback' => ['netzmacht.contao_leaflet.listeners.dca.layer', 'generateDeleteButton'],
],
'toggle' => [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['toggle'],
@@ -119,8 +124,8 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
'attributes' => 'onclick="Backend.getScrollOffset();
return ContaoLeafletAjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => [
'netzmacht.contao_toolkit.dca.listeners.state_button_callback',
'handleButtonCallback',
'netzmacht.contao_leaflet.listeners.dca.layer',
'generateToggleButton',
],
'toolkit' => [
'state_button' => [
@@ -10,6 +10,8 @@
* @filesource
*/
use Netzmacht\Contao\Leaflet\Listener\Dca\OperationsListener;
$GLOBALS['TL_DCA']['tl_leaflet_marker'] = [
'config' => [
'dataContainer' => 'Table',
@@ -23,6 +25,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = [
],
],
'onload_callback' => [
['netzmacht.contao_leaflet.listeners.dca.marker', 'checkPermissions'],
['netzmacht.contao_leaflet.listeners.dca.leaflet', 'loadLanguageFile'],
],
'onsubmit_callback' => [
@@ -45,16 +48,18 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = [
],
'global_operations' => [
'icons' => [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['icons'],
'href' => 'table=tl_leaflet_icon&id=',
'icon' => 'bundles/netzmachtcontaoleaflet/img/icons.png',
'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"',
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['icons'],
'href' => 'table=tl_leaflet_icon&id=',
'icon' => 'bundles/netzmachtcontaoleaflet/img/icons.png',
'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"',
'button_callback' => [OperationsListener::class, 'iconOperation'],
],
'popups' => [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['popups'],
'href' => 'table=tl_leaflet_popup',
'icon' => 'bundles/netzmachtcontaoleaflet/img/popup.png',
'attributes' => 'onclick="Backend.getScrollOffset();"',
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['popups'],
'href' => 'table=tl_leaflet_popup',
'icon' => 'bundles/netzmachtcontaoleaflet/img/popup.png',
'attributes' => 'onclick="Backend.getScrollOffset();"',
'button_callback' => [OperationsListener::class, 'popupOperation'],
],
'all' => [
'label' => &$GLOBALS['TL_LANG']['MSC']['all'],
@@ -10,6 +10,8 @@
* @filesource
*/
use Netzmacht\Contao\Leaflet\Listener\Dca\OperationsListener;
$GLOBALS['TL_DCA']['tl_leaflet_vector'] = [
'config' => [
'dataContainer' => 'Table',
@@ -45,16 +47,18 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = [
],
'global_operations' => [
'styles' => [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['styles'],
'href' => 'table=tl_leaflet_style',
'icon' => 'bundles/netzmachtcontaoleaflet/img/style.png',
'attributes' => 'onclick="Backend.getScrollOffset();"',
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['styles'],
'href' => 'table=tl_leaflet_style',
'icon' => 'bundles/netzmachtcontaoleaflet/img/style.png',
'attributes' => 'onclick="Backend.getScrollOffset();"',
'button_callback' => [OperationsListener::class, 'styleOperation'],
],
'popups' => [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['popups'],
'href' => 'table=tl_leaflet_popup',
'icon' => 'bundles/netzmachtcontaoleaflet/img/popup.png',
'attributes' => 'onclick="Backend.getScrollOffset();"',
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['popups'],
'href' => 'table=tl_leaflet_popup',
'icon' => 'bundles/netzmachtcontaoleaflet/img/popup.png',
'attributes' => 'onclick="Backend.getScrollOffset();"',
'button_callback' => [OperationsListener::class, 'popupOperation'],
],
'all' => [
'label' => &$GLOBALS['TL_LANG']['MSC']['all'],