Browse code

Make permissions more granular

Benjamin Roth authored on02/08/2023 22:20:40
Showing1 changed files
... ...
@@ -15,11 +15,19 @@ use Contao\CoreBundle\DataContainer\PaletteManipulator;
15 15
 // Extend the default palette
16 16
 PaletteManipulator::create()
17 17
     ->addLegend('modal_legend', 'amg_legend', PaletteManipulator::POSITION_BEFORE)
18
-    ->addField(array('modalp'), 'modal_legend', PaletteManipulator::POSITION_APPEND)
18
+    ->addField(array('modals','modalp'), 'modal_legend', PaletteManipulator::POSITION_APPEND)
19 19
     ->applyToPalette('default', 'tl_user_group')
20 20
 ;
21 21
 
22 22
 // Add fields to tl_user_group
23
+$GLOBALS['TL_DCA']['tl_user_group']['fields']['modals'] = array
24
+(
25
+    'inputType'               => 'checkbox',
26
+    'foreignKey'              => 'tl_vr_modal.title',
27
+    'eval'                    => array('multiple'=>true),
28
+    'sql'                     => "blob NULL"
29
+);
30
+
23 31
 $GLOBALS['TL_DCA']['tl_user_group']['fields']['modalp'] = array
24 32
 (
25 33
     'exclude'                 => true,
Browse code

Add popup user privileges

Benjamin Roth authored on12/01/2023 22:23:51
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,31 @@
1
+<?php
2
+
3
+declare(strict_types=1);
4
+
5
+/*
6
+ * This file is part of modal bundle for Contao.
7
+ *
8
+ * (c) Benjamin Roth
9
+ *
10
+ * @license LGPL-3.0-or-later
11
+ */
12
+
13
+use Contao\CoreBundle\DataContainer\PaletteManipulator;
14
+
15
+// Extend the default palette
16
+PaletteManipulator::create()
17
+    ->addLegend('modal_legend', 'amg_legend', PaletteManipulator::POSITION_BEFORE)
18
+    ->addField(array('modalp'), 'modal_legend', PaletteManipulator::POSITION_APPEND)
19
+    ->applyToPalette('default', 'tl_user_group')
20
+;
21
+
22
+// Add fields to tl_user_group
23
+$GLOBALS['TL_DCA']['tl_user_group']['fields']['modalp'] = array
24
+(
25
+    'exclude'                 => true,
26
+    'inputType'               => 'checkbox',
27
+    'options'                 => array('create', 'delete'),
28
+    'reference'               => &$GLOBALS['TL_LANG']['MSC'],
29
+    'eval'                    => array('multiple'=>true),
30
+    'sql'                     => "blob NULL"
31
+);