1# --
2# Copyright (C) 2001-2020 OTRS AG, https://otrs.com/
3# --
4# This software comes with ABSOLUTELY NO WARRANTY. For details, see
5# the enclosed file COPYING for license information (GPL). If you
6# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
7# --
8
9package Kernel::Output::HTML::Notification::SystemConfigurationIsDirtyCheck;
10
11use parent 'Kernel::Output::HTML::Base';
12
13use strict;
14use warnings;
15
16our @ObjectDependencies = (
17    'Kernel::Output::HTML::Layout',
18    'Kernel::System::Group',
19    'Kernel::System::SysConfig',
20);
21
22sub Run {
23    my ( $Self, %Param ) = @_;
24
25    if ( $Param{Type} eq 'Admin' ) {
26        my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
27
28        my $Group = $Param{Config}->{Group} || 'admin';
29
30        my $HasPermission = $Kernel::OM->Get('Kernel::System::Group')->PermissionCheck(
31            UserID    => $Self->{UserID},
32            GroupName => $Group,
33            Type      => 'rw',
34        );
35
36        return '' if !$HasPermission;
37
38        my $Result = $Kernel::OM->Get('Kernel::System::SysConfig')->ConfigurationIsDirtyCheck(
39            UserID => $Self->{UserID},
40        );
41
42        if ($Result) {
43
44            return $LayoutObject->Notify(
45                Priority => 'Notice',
46                Link => $LayoutObject->{Baselink} . 'Action=AdminSystemConfigurationDeployment;Subaction=Deployment',
47                Data => $LayoutObject->{LanguageObject}->Translate(
48                    "You have undeployed settings, would you like to deploy them?"
49                ),
50            );
51        }
52    }
53
54    return '';
55}
56
571;
58