/usr/share/perl5/EBox/Squid/Model/AntiVirus.pm is in zentyal-squid 2.3.11+quantal1.
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 | # Copyright (C) 2009-2012 eBox Technologies S.L.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package EBox::Squid::Model::AntiVirus;
use base 'EBox::Model::DataForm';
use strict;
use warnings;
use EBox::Global;
use EBox::Gettext;
use EBox::Types::Boolean;
use EBox::Exceptions::External;
sub new
{
my $class = shift @_ ;
my $self = $class->SUPER::new(@_);
bless($self, $class);
return $self;
}
sub active
{
my ($self) = @_;
if (not $self->precondition()) {
return 0;
}
my $row = $self->row();
return $row->valueByName('avActive');
}
sub precondition
{
my ($self) = @_;
my $antivirus = EBox::Global->modInstance('antivirus');
defined $antivirus or
return undef;
return $antivirus->isEnabled();
}
sub preconditionFailMsg
{
my $antivirus = EBox::Global->modInstance('antivirus');
my $msg;
if ($antivirus) {
$msg = __x('You cannot activate antivirus filter because the antivirus module is disabled. If you want to filter virus, first {openhref}activate the module{closehref} and come back here',
openhref => qq{<a href='/ServiceModule/StatusView'>},
closehref => qq{</a>});
} else {
$msg = __x('You cannot activate antivirus filter because the antivirus module is not installed. If you want to filter virus, first install it and then {openhref}activate the module{closehref} and come back here',
openhref => qq{<a href='/ServiceModule/StatusView'>},
closehref => qq{</a>});
}
return $msg;
}
sub _tableDescription
{
my @tableDescription = (
new EBox::Types::Boolean(
fieldName => 'avActive',
printableName => __('Use antivirus'),
editable => 1,
defaultValue => 1
),
);
return \@tableDescription;
}
# Method: _table
#
# This method overrides <EBox::Model::DataTable::_table> to return
# a table model description.
#
sub _table
{
my ($self) = @_;
my $tableDescription = $self->_tableDescription();
my $dataForm = {
tableName => 'AntiVirus',
printableTableName => __('Filter virus'),
modelDomain => 'Squid',
defaultActions => [ 'editField', 'changeView' ],
tableDescription => $tableDescription,
class => 'dataForm',
};
return $dataForm;
}
# Method: viewCustomizer
#
# Overrides <EBox::Model::DataTable::viewCustomizer>
# to show breadcrumbs
#
sub viewCustomizer
{
my ($self) = @_;
my $custom = $self->SUPER::viewCustomizer();
$custom->setHTMLTitle([]);
return $custom;
}
1;
|