This file is indexed.

/usr/share/otrs/Kernel/Modules/AdminSystemConfigurationDeployment.pm is in otrs2 6.0.5-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# --
# Copyright (C) 2001-2018 OTRS AG, http://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

package Kernel::Modules::AdminSystemConfigurationDeployment;

use strict;
use warnings;

our $ObjectManagerDisabled = 1;

use Kernel::Language qw(Translatable);

sub new {
    my ( $Type, %Param ) = @_;

    # Allocate new hash for object.
    my $Self = {%Param};
    bless( $Self, $Type );

    return $Self;
}

sub Run {
    my ( $Self, %Param ) = @_;

    my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
    my $ParamObject  = $Kernel::OM->Get('Kernel::System::Web::Request');

    # Lock the deployment
    if ( $Self->{Subaction} eq 'AJAXDeploymentIsLocked' ) {

        my $IsLocked = $Kernel::OM->Get('Kernel::System::SysConfig::DB')->DeploymentIsLocked();

        my $Result = 1;
        if ( !$IsLocked ) {
            $Result = '-1';
        }

        my $JSON = $LayoutObject->JSONEncode(
            Data => $Result,
        );

        return $LayoutObject->Attachment(
            ContentType => 'application/json; charset=' . $LayoutObject->{Charset},
            Content     => $JSON,
            Type        => 'inline',
            NoCache     => 1,
        );
    }

    # Deploy the current configuration state.
    elsif ( $Self->{Subaction} eq 'AJAXDeployment' ) {

        # Challenge token check for write action.
        $LayoutObject->ChallengeTokenCheck();

        my $Comments         = $ParamObject->GetParam( Param => 'Comments' )         || '';
        my $AdvancedMode     = $ParamObject->GetParam( Param => 'AdvancedMode' )     || 0;
        my $SelectedSettings = $ParamObject->GetParam( Param => 'SelectedSettings' ) || '';

        if ($SelectedSettings) {
            $SelectedSettings = $Kernel::OM->Get('Kernel::System::JSON')->Decode( Data => $SelectedSettings );
        }

        my %ReturnData;

        my $SysConfigObject = $Kernel::OM->Get('Kernel::System::SysConfig');

        my %DeploymentResult = $SysConfigObject->ConfigurationDeploy(
            Comments    => $Comments,
            UserID      => $Self->{UserID},
            AllSettings => ($AdvancedMode) ? 1 : 0,
            DirtySettings => $SelectedSettings || undef,
        );

        $ReturnData{Result} = \%DeploymentResult;

        if ( $Self->{LastEntityType} ) {

            # Unset Entity Type.
            $Kernel::OM->Get('Kernel::System::AuthSession')->UpdateSessionID(
                SessionID => $Self->{SessionID},
                Key       => 'LastEntityType',
                Value     => '',
            );
            $ReturnData{RedirectURL} = $Self->{LastScreenEntity};
        }
        elsif ( $SysConfigObject->can('SettingHistory') ) {
            $ReturnData{RedirectURL} = 'Action=AdminSystemConfigurationDeploymentHistory;Subaction=DeploymentHistory';
        }

        my $JSON = $LayoutObject->JSONEncode(
            Data => \%ReturnData,
        );

        return $LayoutObject->Attachment(
            ContentType => 'application/json; charset=' . $LayoutObject->{Charset},
            Content     => $JSON,
            Type        => 'inline',
            NoCache     => 1,
        );
    }

    # Search for settings.
    elsif ( $Self->{Subaction} eq 'Deployment' ) {

        my $SysConfigObject   = $Kernel::OM->Get('Kernel::System::SysConfig');
        my $SysConfigDBObject = $Kernel::OM->Get('Kernel::System::SysConfig::DB');
        my $AdvancedMode      = $ParamObject->GetParam( Param => 'AdvancedMode' ) || '';
        my $DeploymentRestore = $ParamObject->GetParam( Param => 'DeploymentRestore' ) || '';

        my @ModifiedSettingNames;

        if ($AdvancedMode) {
            @ModifiedSettingNames = $SysConfigObject->ConfigurationDirtySettingsList();
        }
        else {
            @ModifiedSettingNames = $SysConfigObject->ConfigurationDirtySettingsList(
                ChangeBy => $Self->{UserID}
            );
        }
        my @Settings;

        for my $SettingName ( sort @ModifiedSettingNames ) {

            my %Versions;

            # Get the current data of the setting.
            my %SettingCurrentState = $SysConfigDBObject->ModifiedSettingGet(
                Name => $SettingName,
            );

            # Get current values.
            my %CurrentValues = $SysConfigObject->SettingGet(
                Name       => $SettingName,
                ModifiedID => $SettingCurrentState{ModifiedID},
            );

            $Versions{Current} = \%CurrentValues;

            # Get default version of this setting.
            my %PreviousValues = $SysConfigObject->SettingGet(
                Name    => $SettingName,
                Default => 1,
            );

            # Get the previous deployed state of this setting.
            my %SettingPreviousState = $SysConfigDBObject->ModifiedSettingVersionGetLast(
                Name => $SettingCurrentState{Name},
            );

            # Use complementary values from previous deployed version (if any).
            if (%SettingPreviousState) {
                %PreviousValues = ( %PreviousValues, %SettingPreviousState );
            }

            $Versions{Previous} = \%PreviousValues;

            push @Settings, \%Versions;
        }

        for my $Setting (@Settings) {

            $Setting->{CurrentName}  = $Setting->{Current}->{Name};
            $Setting->{PreviousName} = $Setting->{Previous}->{Name};
            $Setting->{Navigation}   = $Setting->{Current}->{Navigation};

            # collect setting attributes
            $Setting->{PreviousIsValid} = $Setting->{Previous}->{IsValid};
            $Setting->{CurrentIsValid}  = $Setting->{Current}->{IsValid};

            # collect setting attributes
            $Setting->{PreviousUserModificationActive} = $Setting->{Previous}->{UserModificationActive};
            $Setting->{CurrentUserModificationActive}  = $Setting->{Current}->{UserModificationActive};

            $Setting->{HTMLStrg} = $SysConfigObject->SettingRender(
                Setting => $Setting->{Current},
                UserID  => $Self->{UserID},
            );
            $Setting->{PreviousHTMLStrg} = $SysConfigObject->SettingRender(
                Setting => $Setting->{Previous},
                UserID  => $Self->{UserID},
            );
        }

        my $Output = $LayoutObject->Header();
        $Output .= $LayoutObject->NavigationBar();

        my $DontKnowSettings = $ParamObject->GetParam( Param => 'DontKnowSettings' ) || '';
        if ($DontKnowSettings) {
            $Output .= $LayoutObject->Notify(
                Info => $LayoutObject->{LanguageObject}->Translate(
                    "Some imported settings are not present in the current state of the configuration or it was not possible to update them. Please check the OTRS log for more information."
                ),
                Link => $LayoutObject->{Baselink} . 'Action=AdminLog',
            );
        }

        $Output .= $LayoutObject->Output(
            TemplateFile => 'AdminSystemConfigurationDeployment',
            Data         => {
                SettingList             => \@Settings,
                AdvancedMode            => $AdvancedMode,
                DeploymentRestore       => $DeploymentRestore,
                Readonly                => 1,
                OTRSBusinessIsInstalled => $Kernel::OM->Get('Kernel::System::OTRSBusiness')->OTRSBusinessIsInstalled(),
            },
        );

        $Output .= $LayoutObject->Footer();
        return $Output;

    }

    else {

        # secure mode message (don't allow this action till secure mode is enabled)
        if ( !$Kernel::OM->Get('Kernel::Config')->Get('SecureMode') ) {
            return $LayoutObject->SecureMode();
        }

        return $LayoutObject->Redirect( OP => "Action=AdminSystemConfiguration" );
    }

}

1;