zentyal-printers-2.3.3/0000775000000000000000000000000011727742636011760 5ustar zentyal-printers-2.3.3/src/0000775000000000000000000000000011727742526012545 5ustar zentyal-printers-2.3.3/src/EBox/0000775000000000000000000000000011727742526013402 5ustar zentyal-printers-2.3.3/src/EBox/PrinterFirewall.pm0000664000000000000000000000261311727742526017053 0ustar # Copyright (C) 2008-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::PrinterFirewall; use strict; use warnings; use base 'EBox::FirewallHelper'; use EBox::Objects; use EBox::Global; use EBox::Config; use EBox::Firewall; use EBox::Gettext; sub new { my $class = shift; my %opts = @_; my $self = $class->SUPER::new(@_); bless($self, $class); return $self; } sub output { my $self = shift; my @rules = (); my $printers = EBox::Global->modInstance('printers'); foreach my $id (@{$printers->networkPrinters()}){ my $conf = $printers->methodConf($id); my $host = $conf->{host}; my $port = $conf->{port}; my $r = "-m state --state NEW -p tcp -d $host --dport $port ". "-j ACCEPT"; push (@rules, $r); } return \@rules; } 1; zentyal-printers-2.3.3/src/EBox/Printers.pm0000664000000000000000000003220111727742526015544 0ustar # Copyright (C) 2008-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::Printers; use strict; use warnings; use base qw(EBox::Module::Service EBox::FirewallObserver EBox::Model::ModelProvider EBox::LogObserver EBox::Model::CompositeProvider); use EBox::Gettext; use EBox::Config; use EBox::Service; use EBox::Menu::Item; use EBox::Sudo; use EBox::PrinterFirewall; use EBox::Printers::LogHelper; use Net::CUPS::Destination; use Net::CUPS; use Error qw(:try); use constant CUPSD => '/etc/cups/cupsd.conf'; sub _create { my $class = shift; my $self = $class->SUPER::_create(name => 'printers', printableName => __('Printer Sharing'), @_); bless($self, $class); $self->{'cups'} = new Net::CUPS; return $self; } # Method: actions # # Override EBox::Module::Service::actions # sub actions { return [ { 'action' => __('Create spool directory for printers'), 'reason' => __('Zentyal will create a spool directory ' . 'under /var/spool/samba'), 'module' => 'printers' }, { 'action' => __('Create log table'), 'reason' => __('Zentyal will create a new table into its log database ' . 'to store printers logs'), 'module' => 'printers' }, { 'action' => __x('Disable {server} init script', server => 'cups'), 'reason' => __('Zentyal will take care of start and stop ' . 'the service'), 'module' => 'printers', } ]; } # Method: usedFiles # # Override EBox::Module::Service::files # sub usedFiles { return [ { 'file' => CUPSD, 'reason' => __('To configure cupsd'), 'module' => 'printers', }, ]; } # Method: initialSetup # # Overrides: # EBox::Module::Base::initialSetup # sub initialSetup { my ($self, $version) = @_; # Execute initial-setup script $self->SUPER::initialSetup($version); # Add IPP service only if installing the first time unless ($version) { my $firewall = EBox::Global->modInstance('firewall'); $firewall->addInternalService( 'name' => 'ipp', 'description' => __d('Cups printer server port'), 'protocol' => 'tcp', 'sourcePort' => 'any', 'destinationPort' => 631, ); $firewall->saveConfigRecursive(); } } # Method: enableActions # # Override EBox::Module::Service::enableActions # sub enableActions { my ($self) = @_; # Execute enable-module script $self->SUPER::enableActions(); # Write conf file for the first time using the template, # next times only some lines will be overwritten to # avoid conflicts with CUPS interface $self->writeConfFile(CUPSD, 'printers/cupsd.conf.mas', [ addresses => $self->_ifaceAddresses() ]); } # Method: enableService # # Overrides: # # # sub enableService { my ($self, $status) = @_; $self->SUPER::enableService($status); my $samba = EBox::Global->modInstance('samba'); $samba->setPrinterService($status); } sub restoreDependencies { return [ 'network' ]; } # Method: modelClasses # # Overrides: # # # sub modelClasses { my ($self) = @_; return [ 'EBox::Printers::Model::CUPS' ]; } # Method: compositeClasses # # Overrides: # # # sub compositeClasses { my ($self) = @_; return [ 'EBox::Printers::Composite::General' ]; } sub firewallHelper { my ($self) = @_; if ($self->isEnabled()) { return new EBox::PrinterFirewall(); } return undef; } sub _preSetConf { my ($self) = @_; try { # Stop CUPS in order to force it to dump the conf to disk $self->_stopService(); } otherwise {}; } # Method: _setConf # # Override EBox::Module::Base::_setConf # sub _setConf { my ($self) = @_; $self->_mangleConfFile(CUPSD, addresses => $self->_ifaceAddresses()); } sub _ifaceAddresses { my ($self) = @_; my $net = EBox::Global->modInstance('network'); my $ifacesModel = $self->model('CUPS'); my @addresses; foreach my $row (@{$ifacesModel->enabledRows()}) { my $iface = $ifacesModel->row($row)->valueByName('iface'); my $address = $net->ifaceAddress($iface); next unless $address; push (@addresses, $address); } return \@addresses; } sub _mangleConfFile { my ($self, $path, %params) = @_; my $newContents = ''; my @oldContents = File::Slurp::read_file($path); foreach my $line (@oldContents) { if ($line =~ m{^\s*Listen\s}) { # listen statement, removing next; } elsif ($line =~ m{^\s*SSLListen\s}) { # ssllisten statement, removing next; } elsif ($line =~m/ by Zentyal,/) { # zentyal added skipping next; } $newContents .= $line; } $newContents .= < 'cups', 'type' => 'init.d', 'pidfiles' => ['/var/run/cups/cupsd.pid'], } ]; } sub menu { my ($self, $root) = @_; my $item = new EBox::Menu::Item('name' => 'Printers Sharing', 'url' => 'Printers/Composite/General', 'text' => $self->printableName(), 'separator' => 'Office', 'order' => 550); $root->add($item); } # Method: dumpConfig # # Overrides EBox::Module::Base::dumpConfig # sub dumpConfig { my ($self, $dir, %options) = @_; $self->_stopService(); my @files = ('/etc/cups/printers.conf', '/etc/cups/ppd'); my $backupFiles = ''; foreach my $file (@files) { if (EBox::Sudo::fileTest('-e', $file)) { $backupFiles .= " $file"; } } EBox::Sudo::root("tar cf $dir/etc_cups.tar $backupFiles"); $self->_startService(); } # Method: restoreConfig # # Overrides EBox::Module::Base::dumpConfig # sub restoreConfig { my ($self, $dir) = @_; if (EBox::Sudo::fileTest('-f', "$dir/etc_cups.tar")) { try { $self->_stopService(); EBox::Sudo::root("tar xf $dir/etc_cups.tar -C /"); $self->_startService(); } otherwise { EBox::error("Error restoring cups config from backup"); }; } else { # This case can happen with old backups EBox::warn('Backup doesn\'t contain CUPS configuration files'); } } # Method: networkPrinters # # Returns the printers configured as network printer # # Returns: # # array ref - holding the printer id's # sub networkPrinters { my ($self) = @_; my @ids; # FIXME: This should be get using Net::CUPS as we are not storing # printers in our config anymore # foreach my $printer (@{$self->printers()}) { # my $conf = $self->methodConf($printer->{id}); # push (@ids, $printer->{id}) if ($conf->{method} eq 'network'); # } return \@ids; } # Impelment LogHelper interface sub tableInfo { my ($self) = @_; my $titles = { 'job' => __('Job ID'), 'printer' => __('Printer'), 'username' => __('User'), 'timestamp' => __('Date'), 'event' => __('Event') }; my @order = ('timestamp', 'job', 'printer', 'username', 'event'); my $events = { 'queued' => __('Queued'), 'completed' => __('Completed'), 'canceled' => __('Canceled'), }; return [{ 'name' => __('Printers'), 'tablename' => 'printers_jobs', 'titles' => $titles, 'order' => \@order, 'timecol' => 'timestamp', 'filter' => ['printer', 'username'], 'events' => $events, 'eventcol' => 'event' }]; } sub consolidateReportQueries { return [ { 'target_table' => 'printers_jobs_report', 'query' => { 'select' => 'printer,event,count(*) as nJobs', 'from' => 'printers_jobs', 'group' => 'printer,event', }, 'quote' => { printer => 1 }, }, { 'target_table' => 'printers_jobs_by_user_report', 'query' => { 'select' => 'username,event,count(*) as nJobs', 'from' => 'printers_jobs', 'group' => 'username,event', }, 'quote' => { username => 1 }, }, { target_table => 'printers_usage_report', 'query' => { 'select' => 'printers_jobs.printer, SUM(pages) AS pages, COUNT(DISTINCT printers_jobs.username) AS users', 'from' => 'printers_pages,printers_jobs', 'group' => 'printers_jobs.printer', 'where' => q{(printers_jobs.job = printers_pages.job) and(event='queued')} }, 'quote' => { printer => 1 }, } ]; } # Method: report # # Overrides: # sub report { my ($self, $beg, $end, $options) = @_; my $report = {}; my $db = EBox::DBEngineFactory::DBEngine(); my @events = qw(queued canceled completed); my %eventsByPrinter; foreach my $event (@events) { my $results = $self->runMonthlyQuery($beg, $end, { 'select' => q{printer, SUM(nJobs)}, 'from' => 'printers_jobs_report', 'group' => 'printer', 'where' => qq{event='$event'}, }, { 'key' => 'printer' }); while (my ($printer, $res) = each %{ $results }) { if (not exists $eventsByPrinter{$printer}) { $eventsByPrinter{$printer} = {}; } $eventsByPrinter{$printer}->{$event} = $res->{sum}; } } $report->{eventsByPrinter} = \%eventsByPrinter; my %eventsByUsername; foreach my $event (@events) { my $results = $self->runMonthlyQuery($beg, $end, { 'select' => q{username, SUM(nJobs)}, 'from' => 'printers_jobs_by_user_report', 'group' => 'username', 'where' => qq{event='$event'}, }, { 'key' => 'username' }); while (my ($username, $res) = each %{ $results }) { if (not exists $eventsByUsername{$username}) { $eventsByUsername{$username} = {}; } $eventsByUsername{$username}->{$event} = $res->{sum}; } } $report->{eventsByUser} = \%eventsByUsername; my $printerUsage = $self->runMonthlyQuery($beg, $end, { 'select' => q{printer, pages, users}, 'from' => 'printers_usage_report', # 'group' => 'printer', }, { 'key' => 'printer' } ); # add job fields to usage report foreach my $printer (keys %{ $printerUsage} ) { if (not exists $eventsByPrinter{$printer}) { next; } my @jobs = @{ $eventsByPrinter{$printer}->{queued} }; $printerUsage->{$printer}->{jobs} = \@jobs; } $report->{printerUsage} = $printerUsage; return $report; } sub logHelper { my ($self) = @_; return (new EBox::Printers::LogHelper()); } # Method: fetchExternalCUPSPrinters # # This method returns those printers that haven been configured # by the user using CUPS. # # Returns: # # Array ref - containing the printer names # sub fetchExternalCUPSPrinters { my ($self) = @_; my $cups = Net::CUPS->new(); my @printers; foreach my $printer ($cups->getDestinations()) { my $name = $printer->getName(); push (@printers, $name); } return \@printers; } 1; zentyal-printers-2.3.3/src/EBox/Printers/0000775000000000000000000000000011727742526015210 5ustar zentyal-printers-2.3.3/src/EBox/Printers/LogHelper.pm0000664000000000000000000001171211727742526017431 0ustar # Copyright (C) 2008-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 # Class: EBox::Printers::LogHelper; package EBox::Printers::LogHelper; use base 'EBox::LogHelper'; use strict; use warnings; use EBox; use EBox::Config; use EBox::Gettext; use constant CUPS_MAIN_LOG => '/var/log/cups/error_log'; use constant CUPS_PAGES_LOG => '/var/log/cups/page_log'; my %usernameByJob; my %printerByJob; sub new { my $class = shift; my $self = {}; bless($self, $class); return $self; } # Method: logFiles # # This function must return the file or files to be read from. # # Returns: # # array ref - containing the whole paths # sub logFiles { return [CUPS_MAIN_LOG, CUPS_PAGES_LOG]; } # Method: processLine # # This function will be run every time a new line is recieved in # the associated file. You must parse the line, and generate # the messages which will be logged to ebox through an object # implementing EBox::AbstractLogger interface. # # Parameters: # # file - file name # line - string containing the log line # dbengine- An instance of class implemeting AbstractDBEngineinterface # sub processLine # (file, line, logger) { my ($self, $file, $line, $dbengine, $event) = @_; my $log; if ($file eq CUPS_MAIN_LOG) { _processMainLog(@_); } elsif ($file eq CUPS_PAGES_LOG) { _processPagesLog(@_); } } sub _processMainLog { my ($self, $file, $line, $dbengine) = @_; my $log; if ($line =~ m{ ^\w\s+ # message type (EDI) \[(.*?)\]\s+ # date \[Job\s+(\d+)\]\s+ # job id block (not always present, # but present in 'our' lines ) (.*?) # log message $ }msx) { my $timestamp = $1; my $job = $2; my $msg = $3; my $printer = undef; my $event = undef; my $username = undef; my $deleteJob = 0; if ($msg =~ m/Queued on "(.*?)" by "(.*?)"/) { $event = 'queued'; $printer = $1; $username = $2; $usernameByJob{$job} = $username; $printerByJob{$job} = $printer; } elsif ($msg =~ m/Job completed/) { $event = 'completed'; $username = $usernameByJob{$job}; $printer = $printerByJob{$job}; $deleteJob = 1; } elsif ($msg =~ m/Canceled by "(.*?)"/) { $event = 'canceled'; $username = $1; $printer = $printerByJob{$job}; $deleteJob = 1; } if ($deleteJob) { delete $usernameByJob{$job}; delete $printerByJob{$job}; } if ($event and $username and $printer ) { # normalize timestamp my ($date, $hour) = split ':', $timestamp, 2; # FIXME: check this is ok with MySQL $timestamp = "$date $hour"; my $log = { timestamp => $timestamp, job => $job, printer => $printer, username => $username, event => $event }; $dbengine->insert('printers_jobs', $log); } } } sub _processPagesLog { my ($self, $file, $line, $dbengine) = @_; my $log; if (not $line =~ m{^(.*?)\s+(\d+)\s+.*?\s+\[(.*?)\]\s+\d+\s+(\d+)} ) { return; } my $printer = $1; my $job = $2; my $timestamp = $3; my $copies = $4; # normalize timestamp my ($date, $hour) = split ':', $timestamp, 2; $timestamp = "$date $hour"; $dbengine->insert('printers_pages', { timestamp => $timestamp, printer => $printer, job => $job, pages => $copies, } ); #'hpqueue 13 user [15/Jul/2010:18:48:23 +0200] 4 1DEBUG: - localhost (stdin) na_letter_8.5x11in -', } 1; __DATA__ I [15/Jul/2010:18:17:27 +0200] [Job 8] Canceled by "user". E [15/Jul/2010:15:01:07 +0200] [cups-driverd] Bad driver information file "/usr/share/cups/drv/sample.drv"! I [15/Jul/2010:18:36:21 +0200] [Job 11] Queued on "hpqueue" by "user". I [15/Jul/2010:18:38:54 +0200] [Job 11] Job completed. 1; zentyal-printers-2.3.3/src/EBox/Printers/t/0000775000000000000000000000000011727742526015453 5ustar zentyal-printers-2.3.3/src/EBox/Printers/t/LogHelper.t0000664000000000000000000002674311727742526017535 0ustar # Copyright (C) 2010-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 use strict; use warnings; use lib '../../..'; use EBox::Printers::LogHelper; use Test::More qw(no_plan); use Test::MockObject; use Test::Exception; use EBox::TestStubs; use Data::Dumper; my $dumpInsertedData = 0; use constant JOB_TABLE => "printers_jobs"; use constant PAGES_TABLE => "printers_pages"; # { # no warnings 'redefine'; # sub EBox::Global::modInstance # { # my ($class, $name) = @_; # if ($name ne 'mail') { # die 'Only mocked EBox::Global::modInstance for module mail'; # } # my $fakeVDomains = Test::MockObject->new(); # $fakeVDomains->mock('vdomains' => sub { # return ('monos.org', 'a.com') # } # ); # my $mailMod = { # vdomains => $fakeVDomains, # }; # return $mailMod; # } # } sub newFakeDBEngine { my $dbengine = Test::MockObject->new(); $dbengine->mock('insert' => sub { my ($self, $table, $data) = @_; if (not exists $self->{rows}) { $self->{rows} = []; } my $row = $data; $row->{'_table'} = $table; push @{ $self->{rows} }, $row; } ); $dbengine->mock('clear' => sub { my ($self) = @_; $self->{rows} = []; } ); return $dbengine; } sub _currentYear { my ($sec,$min,$hour,$mday,$mon,$year) = localtime(time()); $year += 1900; return $year; } sub checkInsert { my ($dbengine, $expectedData) = @_; my $data = delete $dbengine->{rows}; if ($dumpInsertedData) { diag "Inserted Data:\n" . Dumper $data; } # my @notNullFields = qw(client_host_ip client_host_name timestamp); # my $failed = 0; # foreach my $field (@notNullFields) { # if ((not exists $data->{$field}) or (not defined $data->{$field})) { # fail "NOT NULL field $field was NULL"; # $failed = 1; # last; # } # } # if (not $failed) { # pass "All NOT-NULL fields don't contain NULLs"; # } is_deeply $data, $expectedData, 'checking if inserted data is correct'; } my $year = _currentYear(); my @cases = ( { name => 'page_log file', file => '/var/log/cups/page_log', lines => [ 'hpqueue 3 root [15/Jul/2010:17:12:17 +0200] 1 1DEBUG: - localhost tmpvRaUM0 na_letter_8.5x11in -', 'hpqueue 3 root [15/Jul/2010:17:13:30 +0200] 2 1DEBUG: - localhost tmpvRaUM0 na_letter_8.5x11in -', 'hpqueue 3 root [15/Jul/2010:17:14:06 +0200] 3 1DEBUG: - localhost tmpvRaUM0 na_letter_8.5x11in -', 'epsonqueue 4 user [15/Jul/2010:17:36:57 +0200] 1 1STATE: - localhost (stdin) na_letter_8.5x11in -', 'hpqueue 3 root [15/Jul/2010:17:14:42 +0200] 4 1DEBUG: - localhost tmpvRaUM0 na_letter_8.5x11in -', 'epsonqueue 4 user [15/Jul/2010:17:38:14 +0200] 2 1DEBUG: - localhost (stdin) na_letter_8.5x11in -', 'epsonqueue 4 user [15/Jul/2010:17:38:50 +0200] 3 1DEBUG: - localhost (stdin) na_letter_8.5x11in -', 'epsonqueue 4 user [15/Jul/2010:17:39:38 +0200] 4 2STATE: - localhost (stdin) na_letter_8.5x11in -', ], expectedData => [ { '_table' => 'printers_pages', 'timestamp' => '15/Jul/2010 17:12:17 +0200', 'printer' => 'hpqueue', 'job' => 3, 'pages' => 1 }, { '_table' => 'printers_pages', 'timestamp' => '15/Jul/2010 17:13:30 +0200', 'printer' => 'hpqueue', 'job' => 3, 'pages' => 1 }, { '_table' => 'printers_pages', 'timestamp' => '15/Jul/2010 17:14:06 +0200', 'printer' => 'hpqueue', 'job' => 3, 'pages' => 1 }, { '_table' => 'printers_pages', 'timestamp' => '15/Jul/2010 17:36:57 +0200', 'printer' => 'epsonqueue', 'job' => 4, 'pages' => 1 }, { '_table' => 'printers_pages', 'timestamp' => '15/Jul/2010 17:14:42 +0200', 'printer' => 'hpqueue', 'job' => 3, 'pages' => 1 }, { '_table' => 'printers_pages', 'printer' => 'epsonqueue', 'timestamp' => '15/Jul/2010 17:38:14 +0200', 'job' => 4, 'pages' => 1 }, { '_table' => 'printers_pages', 'timestamp' => '15/Jul/2010 17:38:50 +0200', 'printer' => 'epsonqueue', 'job' => 4, 'pages' => 1 }, { '_table' => 'printers_pages', 'timestamp' => '15/Jul/2010 17:39:38 +0200', 'printer' => 'epsonqueue', 'job' => 4, 'pages' => 2 }, ], }, { name => 'error_log file', file => '/var/log/cups/error_log', lines => [ 'I [15/Jul/2010:18:03:59 +0200] Listening to 0.0.0.0:631 (IPv4)', 'I [15/Jul/2010:18:03:59 +0200] Listening to :::631 (IPv6)', 'I [15/Jul/2010:18:03:59 +0200] Listening to /var/run/cups/cups.sock (Domain)', q{W [15/Jul/2010:18:03:59 +0200] No limit for CUPS-Get-Document defined in policy default - using Send-Document's policy}, 'I [15/Jul/2010:18:03:59 +0200] Remote access is enabled.', 'I [15/Jul/2010:18:03:59 +0200] Loaded configuration file "/etc/cups/cupsd.conf"', 'I [15/Jul/2010:18:03:59 +0200] Using default TempDir of /var/spool/cups/tmp...', 'I [15/Jul/2010:18:03:59 +0200] Configured for up to 100 clients.', 'I [15/Jul/2010:18:03:59 +0200] Allowing up to 100 client connections per host.', 'I [15/Jul/2010:18:03:59 +0200] Using policy "default" as the default!', 'I [15/Jul/2010:18:03:59 +0200] Full reload is required.', 'I [15/Jul/2010:18:03:59 +0200] Loaded MIME database from "/usr/share/cups/mime" and "/etc/cups": 37 types, 74 filters...', 'I [15/Jul/2010:18:03:59 +0200] Loading job cache file "/var/cache/cups/job.cache"...', 'I [15/Jul/2010:18:03:59 +0200] Full reload complete.', 'I [15/Jul/2010:18:03:59 +0200] Cleaning out old temporary files in "/var/spool/cups/tmp"...', 'E [15/Jul/2010:18:03:59 +0200] Unable to bind socket for address 0.0.0.0:631 - Address already in use.', 'I [15/Jul/2010:18:16:21 +0200] [Job 9] Queued on "hpqueue" by "user".', 'I [15/Jul/2010:18:17:29 +0200] [Job 9] Canceled by "user".', 'D [15/Jul/2010:18:36:21 +0200] add_job: requesting-user-name="user"', 'I [15/Jul/2010:18:36:21 +0200] [Job 11] Adding start banner page "none".', 'D [15/Jul/2010:18:36:21 +0200] Discarding unused job-created event...', 'I [15/Jul/2010:18:36:21 +0200] [Job 11] Queued on "hpqueue" by "user".', 'I [15/Jul/2010:18:38:54 +0200] [Job 11] ready to print', 'D [15/Jul/2010:18:38:54 +0200] Discarding unused printer-state-changed event...', 'D [15/Jul/2010:18:38:54 +0200] Discarding unused job-progress event...', 'D [15/Jul/2010:18:38:54 +0200] PID 8018 (/usr/lib/cups/backend/hp) exited with no errors.', 'D [15/Jul/2010:18:38:54 +0200] Discarding unused job-completed event...', 'I [15/Jul/2010:18:38:54 +0200] [Job 11] Job completed.', ], expectedData => [ { '_table' => 'printers_jobs', timestamp => '15/Jul/2010 18:16:21 +0200', job => 9, printer => 'hpqueue', username => 'user', event => 'queued', }, { '_table' => 'printers_jobs', timestamp => '15/Jul/2010 18:17:29 +0200', job => 9, printer => 'hpqueue', username => 'user', event => 'canceled', }, { '_table' => 'printers_jobs', timestamp => '15/Jul/2010 18:36:21 +0200', job => 11, printer => 'hpqueue', username => 'user', event => 'queued', }, { '_table' => 'printers_jobs', timestamp => '15/Jul/2010 18:38:54 +0200', job => 11, printer => 'hpqueue', username => 'user', event => 'completed', }, ], }, ); my $logHelper = new EBox::Printers::LogHelper(); foreach my $case (@cases) { diag $case->{name}; my @lines = @{ $case->{lines} }; my $dbEngine = newFakeDBEngine(); lives_ok { foreach my $line (@lines) { $logHelper->processLine($case->{file}, $line, $dbEngine); } } 'processing lines'; checkInsert($dbEngine,$case->{expectedData}); } 1; __DATA__ zentyal-printers-2.3.3/src/EBox/Composite/0000775000000000000000000000000011727742526015344 5ustar zentyal-printers-2.3.3/src/EBox/Composite/General.pm0000664000000000000000000000330311727742526017256 0ustar # Copyright (C) 2010-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 # Class: EBox::Printers::Composite::General # # Display the two forms that are exclusively used by remote # services # package EBox::Printers::Composite::General; use base 'EBox::Model::Composite'; use strict; use warnings; use EBox::Gettext; # Group: Public methods # Constructor: new # # Constructor for the general printers composite # # Returns: # # - the general composite # sub new { my ($class) = @_; my $self = $class->SUPER::new(); return $self; } # Group: Protected methods # Method: _description # # Overrides: # # # sub _description { my $printableName = __('Printer Sharing'); my $description = { components => [ 'CUPS' ], layout => 'top-bottom', name => 'General', compositeDomain => 'Printers', printableName => $printableName, pageTitle => $printableName, }; return $description; } 1; zentyal-printers-2.3.3/src/EBox/Model/0000775000000000000000000000000011727742526014442 5ustar zentyal-printers-2.3.3/src/EBox/Model/CUPS.pm0000664000000000000000000001123711727742526015556 0ustar # Copyright (C) 2010-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::Printers::Model::CUPS; # Class: EBox::Printers::Model::CUPS # # Class description # use base 'EBox::Model::DataTable'; use strict; use warnings; use EBox::Gettext; use EBox::View::Customizer; use EBox::Types::Text; use EBox::Types::Boolean; # Group: Public methods # Constructor: new # # Create the new model # # Overrides: # # # sub new { my $class = shift; my $self = $class->SUPER::new(@_); bless ( $self, $class ); return $self; } # Method: viewCustomizer # # Return a custom view customizer to set a permanent message if # the VPN is not enabled or configured # # Overrides: # # # sub viewCustomizer { my ($self) = @_; my $customizer = new EBox::View::Customizer(); $customizer->setModel($self); $customizer->setPermanentMessage($self->_configureMessage()); return $customizer; } # Method: syncRows # # Overrides # sub syncRows { my ($self, $currentRows) = @_; my $net = EBox::Global->modInstance('network'); my $ifaces = $net->ifaces(); my %newIfaces = map { $_ => 1 } @{$ifaces}; my %currentIfaces = map { $self->row($_)->valueByName('iface') => 1 } @{$currentRows}; my $modified = 0; my @ifacesToAdd = grep { not exists $currentIfaces{$_} } @{$ifaces}; foreach my $iface (@ifacesToAdd) { my $enabled = not $net->ifaceIsExternal($iface); $self->add(iface => $iface, enabled => $enabled); $modified = 1; } # Remove old rows foreach my $id (@{$currentRows}) { my $row = $self->row($id); my $ifaceName = $row->valueByName('iface'); next if exists $newIfaces{$ifaceName}; $self->removeRow($id); $modified = 1; } return $modified; } # Method: precondition # # Overrides: # # # sub precondition { my ($self) = @_; return $self->parentModule()->isEnabled(); } # Method: preconditionFailMsg # # Overrides: # # # sub preconditionFailMsg { return __x('Prior to configure printers you need to enable ' . 'the module in the {openref}Module Status{closeref} ' . ' section and save changes after that.', openref => '', closeref => ''); } # Group: Protected methods sub _table { my ($self) = @_; my @tableDesc = ( new EBox::Types::Text( 'fieldName' => 'iface', 'printableName' => __('Interface'), 'unique' => 1, 'editable' => 0 ), new EBox::Types::Boolean( 'fieldName' => 'enabled', 'printableName' => __('Listen'), 'editable' => 1 ), ); my $dataForm = { tableName => 'CUPS', printableTableName => __('Select CUPS Interfaces'), defaultActions => [ 'editField', 'changeView' ], tableDescription => \@tableDesc, modelDomain => 'Printers', sortedBy => 'iface', printableRowName => __('interface'), help => __('Select in which interfaces the CUPS webserver will listen on. Take into account that is not probably a good idea to listen on external interfaces. If none are selected, it will be listening only at localhost'), }; return $dataForm; } sub _configureMessage { my ($self) = @_; my $CUPS_PORT = 631; my $URL = "https://localhost:$CUPS_PORT/admin"; my $message = __x('To add or manage printers you have to use the {open_href}CUPS Web Interface{close_href}', open_href => "", close_href => ''); $message .= ""; return $message; } 1; zentyal-printers-2.3.3/src/scripts/0000775000000000000000000000000011727742526014234 5ustar zentyal-printers-2.3.3/src/scripts/initial-setup0000775000000000000000000000024111727742526016746 0ustar #!/bin/bash # add ebox to lpadmin to manage printers and queues adduser --quiet ebox lpadmin # add ebox to lp to read cups logs adduser --quiet ebox lp exit 0 zentyal-printers-2.3.3/src/scripts/enable-module0000775000000000000000000000054711727742526016701 0ustar #!/bin/bash # stop and disable cups invoke-rc.d cups stop update-rc.d cups disable # create spool if [ ! -d /var/spool/samba ]; then mkdir /var/spool/samba chown nobody:nogroup /var/spool/samba chmod a+rwt /var/spool/samba fi # Set permissions for printer drivers chown -R root:512 /var/lib/samba/printers chmod -R g+w /var/lib/samba/printers zentyal-printers-2.3.3/stubs/0000775000000000000000000000000011727742526013116 5ustar zentyal-printers-2.3.3/stubs/cupsd.conf.mas0000664000000000000000000000574311727742526015673 0ustar <%doc> This template is set to configure printers through samba or standalone cupsd Parameters: standaloneCups - boolean, indicating if the cupsd will be listening on internal interfaces given by as well or not ifaces - array the internal interface name array <%args> @addresses => () # # # Configuration file for the Common UNIX Printing System (CUPS) # scheduler managed automatically by Zentyal. See "man cupsd.conf" for # a complete description of this file. # # Log general information in error_log - change "info" to "debug" for # troubleshooting... LogLevel debug # Administrator user group... SystemGroup lpadmin Listen localhost:631 Listen /var/run/cups/cups.sock % foreach my $address (@addresses) { SSLListen <% $address %>:631 % } # Show shared printers on the local network. Browsing Off BrowseOrder allow,deny BrowseAllow all BrowseAddress @LOCAL # Default authentication type, when authentication is required... DefaultAuthType Basic # Restrict access to the server... Order allow,deny Allow from all # Restrict access to the admin pages... Encryption Required Require group lpadmin Order allow,deny Allow from all # Restrict access to configuration files... AuthType Basic Require group lpadmin Order allow,deny Allow from all Order allow,deny Allow from all Order allow,deny Allow from all # Set the default printer/job policies... # Job-related operations must be done by the owner or an administrator... Require user @OWNER Require group lpadmin Order deny,allow Satisfy any # All administration operations require an administrator to authenticate... AuthType Basic Require group lpadmin Order deny,allow Satisfy any # All printer operations require a printer operator to authenticate... AuthType Basic Require group lpadmin Order deny,allow # Only the owner or an administrator can cancel or authenticate a job... Require user @OWNER Require group lpadmin Order deny,allow Satisfy any Order deny,allow # # zentyal-printers-2.3.3/schemas/0000775000000000000000000000000011727742526013401 5ustar zentyal-printers-2.3.3/schemas/sql/0000775000000000000000000000000011727742526014200 5ustar zentyal-printers-2.3.3/schemas/sql/printers_jobs_report.sql0000664000000000000000000000030211727742526021172 0ustar CREATE TABLE IF NOT EXISTS printers_jobs_report( printer VARCHAR(255) NOT NULL, `date` DATE, event VARCHAR(20) NOT NULL, nJobs INT, INDEX(`date`) ); zentyal-printers-2.3.3/schemas/sql/printers_jobs.sql0000664000000000000000000000035511727742526017607 0ustar CREATE TABLE IF NOT EXISTS printers_jobs( timestamp TIMESTAMP, job INT, printer VARCHAR(255) NOT NULL, username VARCHAR(255) NOT NULL, event VARCHAR(20) NOT NULL, INDEX(timestamp) ); zentyal-printers-2.3.3/schemas/sql/printers_pages.sql0000664000000000000000000000026411727742526017750 0ustar CREATE TABLE IF NOT EXISTS printers_pages( timestamp TIMESTAMP, job INT, printer VARCHAR(255) NOT NULL, pages INT, INDEX(timestamp) ); zentyal-printers-2.3.3/schemas/sql/printers_jobs_by_user_report.sql0000664000000000000000000000026211727742526022727 0ustar CREATE TABLE IF NOT EXISTS printers_jobs_by_user_report( username VARCHAR(255) NOT NULL, `date` DATE, event VARCHAR(20) NOT NULL, nJobs INT, INDEX(`date`) ); zentyal-printers-2.3.3/schemas/sql/printers_usage_report.sql0000664000000000000000000000026211727742526021346 0ustar CREATE TABLE IF NOT EXISTS printers_usage_report( `date` DATE, printer VARCHAR(255) NOT NULL, pages INT, users INT, INDEX(`date`) ); zentyal-printers-2.3.3/schemas/printers.yaml0000664000000000000000000000016411727742526016134 0ustar class: 'EBox::Printers' depends: - samba - network enabledepends: - samba bootdepends: - network zentyal-printers-2.3.3/AUTHORS0000664000000000000000000000024011727742526013022 0ustar Copyright (C) 2004-2012 eBox Technologies S.L. For an updated list of the current and past developers please visit: http://trac.zentyal.org/wiki/Contributors zentyal-printers-2.3.3/COPYING0000664000000000000000000004311011727742526013010 0ustar GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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 Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. zentyal-printers-2.3.3/ChangeLog0000664000000000000000000000531511727742526013534 0ustar 2.3.3 + Add transitional dummy package for ebox-printers 2.3.2 + Packaging fixes for precise 2.3.1 + Updated Standards-Version to 3.9.2 2.3 + Adapted to new MySQL logs backend + Replaced autotools with zbuildtools + Fixed bug which inserted log lines with printer and/or user NULL 2.1.6 + General CUPS parameters set in the CUPS web interface are preserved 2.1.5 + Removed /zentyal prefix from URLs + Avoid duplicated restart during postinst 2.1.4 + Fixed argument passing in constructor, readonly instances now work 2.1.3 + Use upstream init.d script instead of custom upstart one 2.1.2 + Enable CUPS by default on internal interfaces + Use quote column option for periodic and report log consolidation 2.1.1 + Remove unnecessary code from CUPS::syncRows 2.1 + Use new standard enable-module script + Removed unnecesary call to isReadOnly in syncRows + Use new initial-setup and delete migrations + Fixed config backup when some etc files doesn't exist 2.0.2 + CUPS configuration is saved when backing up + Override restoreDepends to remove samba + Added network as dependency of printers + Include support for HP printers by default + Remove duplicated table creation in enable script + cups init.d script is disabled when enabling the module 2.0.1 + Bug fix: cups daemon is now started before samba one 1.5.2 + Zentyal rebrand 1.5.1 + Use CUPS interface instead of eBox to add and manage printers 1.5 + Do not modify /etc/cups/mime.convs as it doesn't exist anymore 1.3.14 + Bug fix: filter some drivers such as /Postcript.+/ + Bug fix: only show Raw model when there is no model available 1.3.13 + Bug fix: cancel jobs + Add a button to print a test page + Check if a model has not available drivers instead of showing an empty select + Add function to check if a printer is already available in CUPS 1.1.30 + Added IPP and LPD printers 1.1.20 + New release 0.12.101 + Bug fix: Use isEnabled() instead of deprecated service() 0.12.1 + Add support for external printers configured with CUPS 0.12 + Bugfix: Create the `job` table when installing. This readds a bunch of lost lines from ubuntu merging. 0.11.101 + New release 0.11.100 + onInstall() functionality moved to migration script + Bugfix. Quote file names to avoid issues with ppds containing spaces 0.11.99 + New release 0.11 + New release 0.10.99 + New release 0.10 + New release 0.9.100 + New release 0.9.99 + New release 0.9.3 + New release 0.9.2 + New release 0.9.1 + New release 0.9 + Added Polish translation + Added German translation 0.8.99 + New release 0.8.1 + New release 0.8 + New release 0.7.99 + Minor bugfixes O.7.1 + GUI improvements + Use of ebox-sudoers-friendly 0.7 + First public release 0.6 + Initial release zentyal-printers-2.3.3/debian/0000775000000000000000000000000011727742526013200 5ustar zentyal-printers-2.3.3/debian/rules0000775000000000000000000000010611727742526014255 0ustar #!/usr/bin/make -f include /usr/share/zbuildtools/1/rules/zentyal.mk zentyal-printers-2.3.3/debian/control0000664000000000000000000000250511727742526014605 0ustar Source: zentyal-printers Section: web Priority: optional Maintainer: Zentyal Packaging Maintainers Uploaders: José A. Calvo Build-Depends: zbuildtools Standards-Version: 3.9.2 Homepage: http://www.zentyal.org/ Vcs-Browser: http://git.zentyal.org/zentyal.git/tree/precise:/main/printers Vcs-Git: git://git.zentyal.org/zentyal.git Package: zentyal-printers Architecture: all Replaces: ebox-printers (<< 2.0.100) Breaks: ebox-printers (<< 2.0.100) Depends: zentyal-core (>= 2.3), zentyal-core (<< 2.3.100), zentyal-samba, cups, libexporter-cluster-perl, libnet-cups-perl, foomatic-db, foomatic-db-engine, foomatic-filters, adduser, hplip, ${misc:Depends} Description: Zentyal - Printer Sharing Service Zentyal is a Linux small business server that can act as a Gateway, Unified Threat Manager, Office Server, Infrastructure Manager, Unified Communications Server or a combination of them. One single, easy-to-use platform to manage all your network services. . This module adds a printer sharing capabilities using CUPS and Samba. Package: ebox-printers Section: oldlibs Architecture: all Depends: zentyal-printers, ${misc:Depends} Description: transitional dummy package eBox Platform has been renamed to Zentyal. This package ensures a upgrade path and can be safely removed after the upgrade. zentyal-printers-2.3.3/debian/copyright0000664000000000000000000000214111727742526015131 0ustar This package was debianized by Zentyal Packaging Maintainers Fri, 20 Feb 2005 15:13:22 +0100. It was downloaded from http://www.zentyal.org/ Files: * Upstream Author: eBox Technologies S.L. Copyright (C) 2004-2012 eBox Technologies S.L. License: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2 file. The Debian packaging is: (C) 2004-2011, Zentyal Packaging Maintainers and is licensed under the GPL, see `/usr/share/common-licenses/GPL-2'. zentyal-printers-2.3.3/debian/changelog0000664000000000000000000000056511727742526015060 0ustar zentyal-printers (2.3.3) precise; urgency=low * Add transitional dummy package for ebox-printers * Add Breaks header -- Jorge Salamero Sanz Tue, 13 Mar 2012 19:25:59 +0100 zentyal-printers (2.3.2) precise; urgency=low * Initial release with new native packaging -- José A. Calvo Fri, 09 Mar 2012 19:19:47 +0100 zentyal-printers-2.3.3/debian/compat0000664000000000000000000000000211727742526014376 0ustar 5 zentyal-printers-2.3.3/debian/zentyal-printers.postrm0000664000000000000000000000033511727742526020001 0ustar #!/bin/bash set -e #DEBHELPER# case "$1" in purge) # purge configuration /usr/share/zentyal/purge-module printers ;; remove) dpkg-trigger --no-await zentyal-core ;; esac exit 0 zentyal-printers-2.3.3/debian/zentyal-printers.postinst0000664000000000000000000000045211727742526020340 0ustar #!/bin/bash set -e #DEBHELPER# case "$1" in configure) # initial setup /usr/share/zentyal/initial-setup --no-restart printers $2 # restart module invoke-rc.d zentyal printers restart || true dpkg-trigger --no-await zentyal-core ;; esac exit 0 zentyal-printers-2.3.3/debian/source/0000775000000000000000000000000011727742526014500 5ustar zentyal-printers-2.3.3/debian/source/format0000664000000000000000000000001511727742526015707 0ustar 3.0 (native)