mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°3936 - Add config parameter to disable theme selection in the user preferences ("user_preferences.allow_backoffice_theme_override")
This commit is contained in:
@@ -93,11 +93,15 @@ class ThemeHandler
|
||||
*/
|
||||
public static function GetCurrentUserThemeId(): string
|
||||
{
|
||||
$sThemeId = null;
|
||||
|
||||
try {
|
||||
$sThemeId = appUserPreferences::GetPref('backoffice_theme', null);
|
||||
if (true === MetaModel::GetConfig()->Get('user_preferences.allow_backoffice_theme_override')) {
|
||||
$sThemeId = appUserPreferences::GetPref('backoffice_theme', null);
|
||||
}
|
||||
}
|
||||
catch (Exception $oException) {
|
||||
$sThemeId = null;
|
||||
// Do nothing, already handled by $sThemeId null by default
|
||||
}
|
||||
|
||||
// Fallback on the app. theme
|
||||
|
||||
@@ -1287,6 +1287,14 @@ class Config
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
],
|
||||
'user_preferences.allow_backoffice_theme_override' => [
|
||||
'type' => 'bool',
|
||||
'description' => 'Whether the user can choose which theme to use in the backoffice. If set to false, all users will have the theme defined in "backoffice_default_theme"',
|
||||
'default' => true,
|
||||
'value' => '',
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
],
|
||||
'secure_rest_services' => [
|
||||
'type' => 'bool',
|
||||
'description' => 'When set to true, only the users with the profile "REST Services User" are allowed to use the REST web services.',
|
||||
|
||||
@@ -79,7 +79,9 @@ function DisplayPreferences($oP)
|
||||
// General
|
||||
$oGeneralFieldset = FieldSetUIBlockFactory::MakeStandard(Dict::S('UI:Preferences:General:Title'), 'ibo-fieldset-for-language-preferences');
|
||||
$oGeneralFieldset->AddSubBlock(GetLanguageFieldBlock());
|
||||
$oGeneralFieldset->AddSubBlock(GetThemeFieldBlock());
|
||||
if (true === MetaModel::GetConfig()->Get('user_preferences.allow_backoffice_theme_override')) {
|
||||
$oGeneralFieldset->AddSubBlock(GetThemeFieldBlock());
|
||||
}
|
||||
$oFirstColumn->AddSubBlock($oGeneralFieldset);
|
||||
|
||||
// Lists
|
||||
|
||||
Reference in New Issue
Block a user