Browse code

Make permissions more granular

Benjamin Roth authored on02/08/2023 22:20:40
Showing1 changed files
... ...
@@ -15,12 +15,20 @@ 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('extend', 'tl_user')
20 20
     ->applyToPalette('custom', 'tl_user')
21 21
 ;
22 22
 
23 23
 // Add fields to tl_user_group
24
+$GLOBALS['TL_DCA']['tl_user']['fields']['modals'] = array
25
+(
26
+    'inputType'               => 'checkbox',
27
+    'foreignKey'              => 'tl_vr_modal.title',
28
+    'eval'                    => array('multiple'=>true),
29
+    'sql'                     => "blob NULL"
30
+);
31
+
24 32
 $GLOBALS['TL_DCA']['tl_user']['fields']['modalp'] = array
25 33
 (
26 34
     '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,32 @@
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('extend', 'tl_user')
20
+    ->applyToPalette('custom', 'tl_user')
21
+;
22
+
23
+// Add fields to tl_user_group
24
+$GLOBALS['TL_DCA']['tl_user']['fields']['modalp'] = array
25
+(
26
+    'exclude'                 => true,
27
+    'inputType'               => 'checkbox',
28
+    'options'                 => array('create', 'delete'),
29
+    'reference'               => &$GLOBALS['TL_LANG']['MSC'],
30
+    'eval'                    => array('multiple'=>true),
31
+    'sql'                     => "blob NULL"
32
+);