From ecc7b2448cf7d4faa04cebbf20fe28bcb9a974f4 Mon Sep 17 00:00:00 2001 From: Pawel Boguslawski Date: Fri, 27 Aug 2021 16:53:56 +0200 Subject: [PATCH 1/3] Added DisableLocalUserDataManagement parameter to disable local agent data management This mod adds DisableLocalUserDataManagement sysconfig parameter (may be defined in Config.pm). Not defined by default. When set to 1, it disables local agent list management in application. May be helpful when agent are synchronized from LDAP only. Author-Change-Id: IB#1110404 --- CHANGES.md | 3 ++ Kernel/Config/Defaults.pm | 4 +++ Kernel/Language/pl.pm | 1 + Kernel/Modules/AdminRoleUser.pm | 7 ++++- Kernel/Modules/AdminUser.pm | 21 ++++++++++++- Kernel/Modules/AdminUserGroup.pm | 5 ++++ .../HTML/Templates/Standard/AdminRoleUser.tt | 3 ++ .../HTML/Templates/Standard/AdminUser.tt | 30 ++++++++++++++----- .../HTML/Templates/Standard/AdminUserGroup.tt | 3 ++ 9 files changed, 68 insertions(+), 9 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index e84cd1797d8..53ef238cf45 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,6 @@ +# 6.5.2 ????-??-?? + - 2023-04-26 Added DisableLocalUserDataManagement parameter to disable local agent data management. + # 6.5.1 2023-03-09 - 2023-02-28 Added options tickets-created-before-date and tickets-created-before-days to console command Admin::Article::StorageSwitch. - 2023-02-28 Fixed encoding of postmaster filter name in AdminPostMasterFilter. diff --git a/Kernel/Config/Defaults.pm b/Kernel/Config/Defaults.pm index efd92a01857..6c64de95410 100644 --- a/Kernel/Config/Defaults.pm +++ b/Kernel/Config/Defaults.pm @@ -588,6 +588,10 @@ sub LoadDefaults { # Utilize extended nested group search? (may impact performance) # $Self->{'AuthSyncModule::LDAP::NestedGroupSearch'} = 1; + # DisableLocalUserDataManagement + # Set to 1 do disable local user data management (if synchronized from LDAP only for example). +# $Self->{'DisableLocalUserDataManagement'} = 1; + # AuthSyncModule::LDAP::UserSyncGroupsDefinition # (If "LDAP" was selected for AuthModule and you want to sync LDAP # groups to otrs groups, define the following.) diff --git a/Kernel/Language/pl.pm b/Kernel/Language/pl.pm index 2113bba1e85..0fad74bc968 100644 --- a/Kernel/Language/pl.pm +++ b/Kernel/Language/pl.pm @@ -2307,6 +2307,7 @@ sub Data { # TT Template: Kernel/Output/HTML/Templates/Standard/AdminUser.tt 'Agent Management' => 'Zarządzanie agentami', 'Edit Agent' => 'Edytuj agenta', + 'Agent Data' => 'Dane agenta', 'Edit personal preferences for this agent' => 'Edytuj ustawienia osobiste tego agenta', 'Agents will be needed to handle tickets.' => 'Agenci są potrzebni do obsługi zgłoszeń.', 'Don\'t forget to add a new agent to groups and/or roles!' => 'Nie zapomnij dodać nowego agenta do grup lub/i ról!', diff --git a/Kernel/Modules/AdminRoleUser.pm b/Kernel/Modules/AdminRoleUser.pm index 3d383f24485..133d073c48e 100644 --- a/Kernel/Modules/AdminRoleUser.pm +++ b/Kernel/Modules/AdminRoleUser.pm @@ -1,6 +1,7 @@ # -- # Copyright (C) 2001-2021 OTRS AG, https://otrs.com/ # Copyright (C) 2021 Znuny GmbH, https://znuny.org/ +# Copyright (C) 2021 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/ # -- # This software comes with ABSOLUTELY NO WARRANTY. For details, see # the enclosed file COPYING for license information (GPL). If you @@ -298,7 +299,11 @@ sub _Overview { $LayoutObject->Block( Name => 'Overview', - Data => {}, + Data => { + + # Hide agent add option if local user data management is disabled. + DisableLocalUserDataManagement => $Kernel::OM->Get('Kernel::Config')->Get('DisableLocalUserDataManagement'), + }, ); # get user list diff --git a/Kernel/Modules/AdminUser.pm b/Kernel/Modules/AdminUser.pm index a6f4d24e95f..ed38563f590 100644 --- a/Kernel/Modules/AdminUser.pm +++ b/Kernel/Modules/AdminUser.pm @@ -160,6 +160,7 @@ sub Run { my $Note = ''; my ( %GetParam, %Errors ); + for my $Parameter ( qw(UserID UserTitle UserLogin UserFirstname UserLastname UserEmail UserPw UserMobile ValidID Search) ) @@ -194,6 +195,11 @@ sub Run { $Errors{'UserLoginInvalid'} = 'ServerError'; } + # Don't allow local agent data changes if local user data management is disabled. + if ( $Kernel::OM->Get('Kernel::Config')->Get('DisableLocalUserDataManagement') ) { + $Note = $Kernel::OM->Get('Kernel::Language')->Translate('Local agent data management is disabled.'); + } + # if no errors occurred if ( !%Errors ) { @@ -334,6 +340,11 @@ sub Run { $Errors{'UserLoginInvalid'} = 'ServerError'; } + # Don't allow local agent data changes if local user data management is disabled. + if ( $Kernel::OM->Get('Kernel::Config')->Get('DisableLocalUserDataManagement') ) { + $Note = $Kernel::OM->Get('Kernel::Language')->Translate('Local agent data management is disabled.'); + } + # if no errors occurred if ( !%Errors ) { @@ -458,11 +469,15 @@ sub _Edit { my %ValidList = $Kernel::OM->Get('Kernel::System::Valid')->ValidList(); my %ValidListReverse = reverse %ValidList; + # Put all user data in read-only mode if local user data management is disabled. + $Param{DisableLocalUserDataManagement} = $Kernel::OM->Get('Kernel::Config')->Get('DisableLocalUserDataManagement'); + $Param{ValidOption} = $LayoutObject->BuildSelection( Data => \%ValidList, Name => 'ValidID', SelectedID => $Param{ValidID} || $ValidListReverse{valid}, Class => 'Modernize', + Disabled => $Param{DisableLocalUserDataManagement} ? 1 : 0, ); $LayoutObject->Block( @@ -532,7 +547,11 @@ sub _Overview { Name => 'ActionSearch', Data => \%Param, ); - $LayoutObject->Block( Name => 'ActionAdd' ); + + # Put all user data in read-only mode if local user data management is disabled. + if ( !$Kernel::OM->Get('Kernel::Config')->Get('DisableLocalUserDataManagement') ) { + $LayoutObject->Block( Name => 'ActionAdd' ); + } # get user object my $UserObject = $Kernel::OM->Get('Kernel::System::User'); diff --git a/Kernel/Modules/AdminUserGroup.pm b/Kernel/Modules/AdminUserGroup.pm index e5375d26284..f0b64d16a44 100644 --- a/Kernel/Modules/AdminUserGroup.pm +++ b/Kernel/Modules/AdminUserGroup.pm @@ -379,6 +379,11 @@ sub _Overview { ); $LayoutObject->Block( Name => 'NewActions', + Data => { + + # Hide agent add option if local user data management is disabled. + DisableLocalUserDataManagement => $Kernel::OM->Get('Kernel::Config')->Get('DisableLocalUserDataManagement'), + }, ); $LayoutObject->Block( diff --git a/Kernel/Output/HTML/Templates/Standard/AdminRoleUser.tt b/Kernel/Output/HTML/Templates/Standard/AdminRoleUser.tt index 7db3f17ddf2..10ca63e09f1 100644 --- a/Kernel/Output/HTML/Templates/Standard/AdminRoleUser.tt +++ b/Kernel/Output/HTML/Templates/Standard/AdminRoleUser.tt @@ -1,6 +1,7 @@ # -- # Copyright (C) 2001-2021 OTRS AG, https://otrs.com/ # Copyright (C) 2021 Znuny GmbH, https://znuny.org/ +# Copyright (C) 2021 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/ # -- # This software comes with ABSOLUTELY NO WARRANTY. For details, see # the enclosed file COPYING for license information (GPL). If you @@ -30,9 +31,11 @@
@@ -183,11 +191,15 @@ [% RenderBlockStart("OverviewUpdate") %]
+ [% IF Data.DisableLocalUserDataManagement %] +

[% Translate("Agent Data") | html %]

+ [% ELSE %] [% IF Data.Action == "Add" %]

[% Translate("Add Agent") | html %]

[% ELSE %]

[% Translate("Edit Agent") | html %]

[% END %] + [% END %]
@@ -203,13 +215,13 @@
- +
- +

[% Translate("This field is required.") | html %]

[% Translate("This field is required.") | html %]

@@ -217,7 +229,7 @@
- +

[% Translate("This field is required.") | html %]

[% Translate("This field is required.") | html %]

@@ -225,7 +237,7 @@
- +

[% Translate("This field is required.") | html %]

[% RenderBlockStart("UserLoginServerError") %] @@ -242,7 +254,7 @@ [% Translate("Password") | html %]:
- + [% RenderBlockStart("ShowPasswordHint") %]

[% Translate("Will be auto-generated if left empty.") | html %] @@ -253,7 +265,7 @@

- +

[% Translate("This field is required and needs to be a valid email address.") | html %]

[% RenderBlockStart("UserEmailServerErrorMsg") %]

[% Translate("This field is required.") | html %]

@@ -275,7 +287,7 @@
- +
@@ -286,6 +298,7 @@
+ [% IF !Data.DisableLocalUserDataManagement %] [% IF Data.Action == 'Change' %] [% Translate("or") | html %] @@ -295,6 +308,9 @@ [% END %] [% Translate("or") | html %] [% Translate("Cancel") | html %] + [% ELSE %] + [% Translate("Close") | html %] + [% END %]
diff --git a/Kernel/Output/HTML/Templates/Standard/AdminUserGroup.tt b/Kernel/Output/HTML/Templates/Standard/AdminUserGroup.tt index 5e4c8fb57ef..3a6f9311915 100644 --- a/Kernel/Output/HTML/Templates/Standard/AdminUserGroup.tt +++ b/Kernel/Output/HTML/Templates/Standard/AdminUserGroup.tt @@ -1,6 +1,7 @@ # -- # Copyright (C) 2001-2021 OTRS AG, https://otrs.com/ # Copyright (C) 2021 Znuny GmbH, https://znuny.org/ +# Copyright (C) 2021 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/ # -- # This software comes with ABSOLUTELY NO WARRANTY. For details, see # the enclosed file COPYING for license information (GPL). If you @@ -37,9 +38,11 @@ [% RenderBlockEnd("ActionOverview") %] [% RenderBlockStart("NewActions") %] +[% IF !Data.DisableLocalUserDataManagement %]
  • [% Translate("Add Agent") | html %]
  • +[% END %]
  • [% Translate("Add Group") | html %]
  • From f2b2059e393c0335647b0fa702bbbd906a8566cb Mon Sep 17 00:00:00 2001 From: Pawel Boguslawski Date: Fri, 27 Aug 2021 17:18:58 +0200 Subject: [PATCH 2/3] Extra newline removed Fixes: 8f98bc99c36b7cd71f6d8c29a22e73635be14acd Author-Change-Id: IB#1110404 --- Kernel/Modules/AdminUser.pm | 1 - 1 file changed, 1 deletion(-) diff --git a/Kernel/Modules/AdminUser.pm b/Kernel/Modules/AdminUser.pm index ed38563f590..10738259863 100644 --- a/Kernel/Modules/AdminUser.pm +++ b/Kernel/Modules/AdminUser.pm @@ -160,7 +160,6 @@ sub Run { my $Note = ''; my ( %GetParam, %Errors ); - for my $Parameter ( qw(UserID UserTitle UserLogin UserFirstname UserLastname UserEmail UserPw UserMobile ValidID Search) ) From 93eb0fb5092a86056510dcaba596d6bde6a61cc3 Mon Sep 17 00:00:00 2001 From: Pawel Boguslawski Date: Wed, 26 Apr 2023 11:06:50 +0200 Subject: [PATCH 3/3] Changelog, translation and copyright removed Author-Change-Id: IB#1110404 --- CHANGES.md | 3 --- Kernel/Language/pl.pm | 1 - Kernel/Modules/AdminRoleUser.pm | 1 - Kernel/Output/HTML/Templates/Standard/AdminRoleUser.tt | 1 - Kernel/Output/HTML/Templates/Standard/AdminUser.tt | 1 - Kernel/Output/HTML/Templates/Standard/AdminUserGroup.tt | 1 - 6 files changed, 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 53ef238cf45..e84cd1797d8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,3 @@ -# 6.5.2 ????-??-?? - - 2023-04-26 Added DisableLocalUserDataManagement parameter to disable local agent data management. - # 6.5.1 2023-03-09 - 2023-02-28 Added options tickets-created-before-date and tickets-created-before-days to console command Admin::Article::StorageSwitch. - 2023-02-28 Fixed encoding of postmaster filter name in AdminPostMasterFilter. diff --git a/Kernel/Language/pl.pm b/Kernel/Language/pl.pm index 0fad74bc968..2113bba1e85 100644 --- a/Kernel/Language/pl.pm +++ b/Kernel/Language/pl.pm @@ -2307,7 +2307,6 @@ sub Data { # TT Template: Kernel/Output/HTML/Templates/Standard/AdminUser.tt 'Agent Management' => 'Zarządzanie agentami', 'Edit Agent' => 'Edytuj agenta', - 'Agent Data' => 'Dane agenta', 'Edit personal preferences for this agent' => 'Edytuj ustawienia osobiste tego agenta', 'Agents will be needed to handle tickets.' => 'Agenci są potrzebni do obsługi zgłoszeń.', 'Don\'t forget to add a new agent to groups and/or roles!' => 'Nie zapomnij dodać nowego agenta do grup lub/i ról!', diff --git a/Kernel/Modules/AdminRoleUser.pm b/Kernel/Modules/AdminRoleUser.pm index 133d073c48e..6c7ec2c5def 100644 --- a/Kernel/Modules/AdminRoleUser.pm +++ b/Kernel/Modules/AdminRoleUser.pm @@ -1,7 +1,6 @@ # -- # Copyright (C) 2001-2021 OTRS AG, https://otrs.com/ # Copyright (C) 2021 Znuny GmbH, https://znuny.org/ -# Copyright (C) 2021 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/ # -- # This software comes with ABSOLUTELY NO WARRANTY. For details, see # the enclosed file COPYING for license information (GPL). If you diff --git a/Kernel/Output/HTML/Templates/Standard/AdminRoleUser.tt b/Kernel/Output/HTML/Templates/Standard/AdminRoleUser.tt index 10ca63e09f1..ae04ccdb3ff 100644 --- a/Kernel/Output/HTML/Templates/Standard/AdminRoleUser.tt +++ b/Kernel/Output/HTML/Templates/Standard/AdminRoleUser.tt @@ -1,7 +1,6 @@ # -- # Copyright (C) 2001-2021 OTRS AG, https://otrs.com/ # Copyright (C) 2021 Znuny GmbH, https://znuny.org/ -# Copyright (C) 2021 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/ # -- # This software comes with ABSOLUTELY NO WARRANTY. For details, see # the enclosed file COPYING for license information (GPL). If you diff --git a/Kernel/Output/HTML/Templates/Standard/AdminUser.tt b/Kernel/Output/HTML/Templates/Standard/AdminUser.tt index f15f5374ddc..da58f50a8c6 100644 --- a/Kernel/Output/HTML/Templates/Standard/AdminUser.tt +++ b/Kernel/Output/HTML/Templates/Standard/AdminUser.tt @@ -1,7 +1,6 @@ # -- # Copyright (C) 2001-2021 OTRS AG, https://otrs.com/ # Copyright (C) 2021 Znuny GmbH, https://znuny.org/ -# Copyright (C) 2021 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/ # -- # This software comes with ABSOLUTELY NO WARRANTY. For details, see # the enclosed file COPYING for license information (GPL). If you diff --git a/Kernel/Output/HTML/Templates/Standard/AdminUserGroup.tt b/Kernel/Output/HTML/Templates/Standard/AdminUserGroup.tt index 3a6f9311915..fbf00e589b5 100644 --- a/Kernel/Output/HTML/Templates/Standard/AdminUserGroup.tt +++ b/Kernel/Output/HTML/Templates/Standard/AdminUserGroup.tt @@ -1,7 +1,6 @@ # -- # Copyright (C) 2001-2021 OTRS AG, https://otrs.com/ # Copyright (C) 2021 Znuny GmbH, https://znuny.org/ -# Copyright (C) 2021 Informatyka Boguslawski sp. z o.o. sp.k., http://www.ib.pl/ # -- # This software comes with ABSOLUTELY NO WARRANTY. For details, see # the enclosed file COPYING for license information (GPL). If you