Skip to content

Commit

Permalink
Merge PR #306 from @stefanheimes
Browse files Browse the repository at this point in the history
Update the user groups and user dca pallets to add the rights for syncCto.
  • Loading branch information
stefanheimes authored Mar 15, 2021
2 parents a4fa516 + 72a7e63 commit b1a055c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
14 changes: 11 additions & 3 deletions src/Resources/contao/dca/tl_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,17 @@
/**
* Extend default palette
*/
$GLOBALS['TL_DCA']['tl_user']['palettes']['extend'] = str_replace('disable', '{syncCto_legend},syncCto_clients,syncCto_clients_p,syncCto_sync_options;{syncCto_tables_legend},syncCto_tables;{account_legend},disable', $GLOBALS['TL_DCA']['tl_user']['palettes']['extend']);
$GLOBALS['TL_DCA']['tl_user']['palettes']['custom'] = str_replace('disable,', '{syncCto_legend},syncCto_clients,syncCto_clients_p,syncCto_sync_options;{syncCto_tables_legend},syncCto_tables;{account_legend},disable', $GLOBALS['TL_DCA']['tl_user']['palettes']['custom']);
$GLOBALS['TL_DCA']['tl_user']['palettes']['login'] = str_replace('useCE', 'useCE,syncCto_useTranslatedNames', $GLOBALS['TL_DCA']['tl_user']['palettes']['login']);
foreach(['extend', 'custom'] as $palette){
$parts = explode(';', $GLOBALS['TL_DCA']['tl_user']['palettes'][$palette]);
if(is_array($parts)){
\array_insert($parts, (count($parts) - 1), [
'{syncCto_legend},syncCto_clients,syncCto_clients_p,syncCto_sync_options',
'{syncCto_tables_legend},syncCto_tables'
]);
$GLOBALS['TL_DCA']['tl_user']['palettes'][$palette] = implode(';', $parts);
}
}

/**
* Add fields to tl_user
Expand Down Expand Up @@ -63,4 +71,4 @@
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('tl_class' => 'w50')
);
);
11 changes: 9 additions & 2 deletions src/Resources/contao/dca/tl_user_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@
/**
* Extend default palette
*/
$GLOBALS['TL_DCA']['tl_user_group']['palettes']['default'] = str_replace('alexf;', '{syncCto_legend},syncCto_clients,syncCto_clients_p,syncCto_sync_options;{syncCto_tables_legend},syncCto_tables;{alexf_legend},alexf;', $GLOBALS['TL_DCA']['tl_user_group']['palettes']['default']);
$parts = explode(';', $GLOBALS['TL_DCA']['tl_user_group']['palettes']['default']);
if(is_array($parts)){
\array_insert($parts, (count($parts) - 1), [
'{syncCto_legend},syncCto_clients,syncCto_clients_p,syncCto_sync_options',
'{syncCto_tables_legend},syncCto_tables'
]);
$GLOBALS['TL_DCA']['tl_user_group']['palettes']['default'] = implode(';', $parts);
}

/**
* Add fields to tl_user_group
Expand Down Expand Up @@ -53,4 +60,4 @@
'exclude' => true,
'eval' => array('multiple' => true),
'options_callback' => array('SyncCtoHelper', 'databaseTables'),
);
);

0 comments on commit b1a055c

Please sign in to comment.