mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2026-05-31 20:08:02 +02:00
Implement permission configuration.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Backend module.
|
||||
* Backend modules
|
||||
*/
|
||||
|
||||
array_insert(
|
||||
@@ -48,8 +48,9 @@ if (TL_MODE === 'BE') {
|
||||
$GLOBALS['TL_CSS'][] = 'bundles/netzmachtcontaoleaflet/css/backend_global.css';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Models.
|
||||
* Models
|
||||
*/
|
||||
|
||||
$GLOBALS['TL_MODELS']['tl_leaflet_control'] = \Netzmacht\Contao\Leaflet\Model\ControlModel::class;
|
||||
@@ -60,3 +61,12 @@ $GLOBALS['TL_MODELS']['tl_leaflet_marker'] = \Netzmacht\Contao\Leaflet\Model\Ma
|
||||
$GLOBALS['TL_MODELS']['tl_leaflet_popup'] = \Netzmacht\Contao\Leaflet\Model\PopupModel::class;
|
||||
$GLOBALS['TL_MODELS']['tl_leaflet_style'] = \Netzmacht\Contao\Leaflet\Model\StyleModel::class;
|
||||
$GLOBALS['TL_MODELS']['tl_leaflet_vector'] = \Netzmacht\Contao\Leaflet\Model\VectorModel::class;
|
||||
|
||||
|
||||
/*
|
||||
* Permissions
|
||||
*/
|
||||
|
||||
$GLOBALS['TL_PERMISSIONS'][] = 'leaflet_layers';
|
||||
$GLOBALS['TL_PERMISSIONS'][] = 'leaflet_layer_permissions';
|
||||
$GLOBALS['TL_PERMISSIONS'][] = 'leaflet_tables';
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Leaflet maps for Contao CMS.
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2014-2018 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Contao\CoreBundle\DataContainer\PaletteManipulator;
|
||||
|
||||
PaletteManipulator::create()
|
||||
->addLegend('leaflet_legend', 'amg_legend', PaletteManipulator::POSITION_BEFORE)
|
||||
->addField(
|
||||
['leaflet_layers', 'leaflet_layer_permissions', 'leaflet_tables'],
|
||||
'leaflet_legend',
|
||||
PaletteManipulator::POSITION_APPEND
|
||||
)
|
||||
->applyToPalette('extend', 'tl_user')
|
||||
->applyToPalette('custom', 'tl_user');
|
||||
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_user']['fields']['leaflet_layers'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_user']['leaflet_layers'],
|
||||
'exclude' => true,
|
||||
'inputType' => 'treePicker',
|
||||
'eval' => [
|
||||
'foreignTable' => 'tl_leaflet_layer',
|
||||
'titleField' => 'title',
|
||||
'searchField' => 'title',
|
||||
'managerHref' => 'do=leaflet_layer',
|
||||
'fieldType' => 'checkbox',
|
||||
'selectParents' => true,
|
||||
'multiple' => true,
|
||||
'pickerCallback' => ['netzmacht.contao_leaflet.listeners.dca.user', 'generateLayersRowLabel']
|
||||
],
|
||||
'sql' => 'blob NULL',
|
||||
];
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_user']['fields']['leaflet_tables'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_user']['leaflet_tables'],
|
||||
'exclude' => true,
|
||||
'inputType' => 'checkbox',
|
||||
'options' => ['tl_leaflet_style', 'tl_leaflet_icon', 'tl_leaflet_popup'],
|
||||
'reference' => &$GLOBALS['TL_LANG']['MOD'],
|
||||
'eval' => [
|
||||
'multiple' => true,
|
||||
],
|
||||
'sql' => 'mediumblob NULL',
|
||||
];
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_user']['fields']['leaflet_layer_permissions'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions'],
|
||||
'exclude' => true,
|
||||
'inputType' => 'checkbox',
|
||||
'options' => ['create', 'edit', 'delete', 'data'],
|
||||
'reference' => &$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options'],
|
||||
'eval' => [
|
||||
'helpwizard' => true,
|
||||
'multiple' => true,
|
||||
],
|
||||
'sql' => 'mediumblob NULL',
|
||||
];
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Leaflet maps for Contao CMS.
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2014-2018 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Contao\CoreBundle\DataContainer\PaletteManipulator;
|
||||
|
||||
PaletteManipulator::create()
|
||||
->addLegend('leaflet_legend', 'amg_legend', PaletteManipulator::POSITION_BEFORE)
|
||||
->addField(
|
||||
['leaflet_layers', 'leaflet_layer_permissions', 'leaflet_tables'],
|
||||
'leaflet_legend',
|
||||
PaletteManipulator::POSITION_APPEND
|
||||
)
|
||||
->applyToPalette('default', 'tl_user_group');
|
||||
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_user_group']['fields']['leaflet_layers'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layers'],
|
||||
'exclude' => true,
|
||||
'inputType' => 'treePicker',
|
||||
'eval' => [
|
||||
'foreignTable' => 'tl_leaflet_layer',
|
||||
'titleField' => 'title',
|
||||
'searchField' => 'title',
|
||||
'managerHref' => 'do=leaflet_layer',
|
||||
'fieldType' => 'checkbox',
|
||||
'selectParents' => true,
|
||||
'multiple' => true,
|
||||
'pickerCallback' => ['netzmacht.contao_leaflet.listeners.dca.user_group', 'generateLayersRowLabel']
|
||||
],
|
||||
'sql' => 'blob NULL',
|
||||
];
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_user_group']['fields']['leaflet_tables'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_user_group']['leaflet_tables'],
|
||||
'exclude' => true,
|
||||
'inputType' => 'checkbox',
|
||||
'options' => ['tl_leaflet_style', 'tl_leaflet_icon', 'tl_leaflet_popup'],
|
||||
'reference' => &$GLOBALS['TL_LANG']['MOD'],
|
||||
'eval' => [
|
||||
'multiple' => true,
|
||||
],
|
||||
'sql' => 'mediumblob NULL',
|
||||
];
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_user_group']['fields']['leaflet_layer_permissions'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions'],
|
||||
'exclude' => true,
|
||||
'inputType' => 'checkbox',
|
||||
'options' => ['create', 'edit', 'delete', 'data'],
|
||||
'reference' => &$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options'],
|
||||
'eval' => [
|
||||
'helpwizard' => true,
|
||||
'multiple' => true,
|
||||
],
|
||||
'sql' => 'mediumblob NULL',
|
||||
];
|
||||
@@ -22,6 +22,8 @@ $GLOBALS['TL_LANG']['MOD']['leaflet_about'][1] = 'About the Leaflet integration
|
||||
$GLOBALS['TL_LANG']['MOD']['tl_leaflet_map'] = 'Maps';
|
||||
$GLOBALS['TL_LANG']['MOD']['tl_leaflet_layer'] = 'Layers';
|
||||
$GLOBALS['TL_LANG']['MOD']['tl_leaflet_icon'] = 'Icons';
|
||||
$GLOBALS['TL_LANG']['MOD']['tl_leaflet_style'] = 'Styles';
|
||||
$GLOBALS['TL_LANG']['MOD']['tl_leaflet_popup'] = 'Popup';
|
||||
$GLOBALS['TL_LANG']['MOD']['tl_leaflet_marker'] = 'Markers';
|
||||
$GLOBALS['TL_LANG']['MOD']['tl_leaflet_control'] = 'Controls';
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Leaflet maps for Contao CMS.
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2014-2018 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_legend'] = 'Leaflet Maps Permissions';
|
||||
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layers'][0] = 'Allowed map layers';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layers'][1] = 'Please choose the allowed map layers.';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions'][0] = 'Layer permissions';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions'][1] = 'Please choose which permissions are allowed for the map layer.';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_tables'][0] = 'Allows map tables';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_tables'][1] = 'Please choose which tables are allowed.';
|
||||
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options']['create'][0] = 'Create layers';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options']['create'][1] = 'Grant permission to create new layers.';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options']['edit'][0] = 'Edit layers';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options']['edit'][1] = 'Grant permission to edit layers.';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options']['delete'][0] = 'Delete layers';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options']['delete'][1] = 'Grant permission to delete layers.';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options']['data'][0] = 'Edit data';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options']['data'][1] = 'Grant permission to edit data of a layer.';
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Leaflet maps for Contao CMS.
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2014-2018 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_legend'] = 'Leaflet Maps Permissions';
|
||||
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layers'][0] = 'Allowed map layers';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layers'][1] = 'Please choose the allowed map layers.';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions'][0] = 'Layer permissions';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions'][1] = 'Please choose which permissions are allowed for the map layer.';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_tables'][0] = 'Allows map tables';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_tables'][1] = 'Please choose which tables are allowed.';
|
||||
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options']['create'][0] = 'Create layers';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options']['create'][1] = 'Grant permission to create new layers.';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options']['edit'][0] = 'Edit layers';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options']['edit'][1] = 'Grant permission to edit layers.';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options']['delete'][0] = 'Delete layers';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options']['delete'][1] = 'Grant permission to delete layers.';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options']['data'][0] = 'Edit data';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options']['data'][1] = 'Grant permission to edit data of a layer.';
|
||||
Reference in New Issue
Block a user