Eigenes Recht für E-Mail-Journal
authorMartin Helmling <martin.helmling@octosoft.eu>
Tue, 17 Jan 2017 14:36:51 +0000 (15:36 +0100)
committerMartin Helmling martin.helmling@octosoft.eu <martin.helmling@octosoft.eu>
Wed, 1 Feb 2017 07:52:41 +0000 (08:52 +0100)
-E-Mail Journal Icon hinzugefügt
-Recht für E-Mail Journal hinzugefügt, von "productivity" abgeleitet
-Recht für Zugriff auf mails von Mitarbeitern von "admin" abgeleitet
-Das Recht "email_journal" im EmailJournal - Controller eingebaut

SL/Controller/EmailJournal.pm
image/icons/svg/mail_journal.svg [new file with mode: 0644]
locale/de/all
menus/user/00-erp.yaml
sql/Pg-upgrade2-auth/mail_journal_rights.pl [new file with mode: 0644]

index 6dfed90..a4ffc62 100644 (file)
@@ -27,6 +27,8 @@ __PACKAGE__->run_before('add_stylesheet');
 sub action_list {
   my ($self) = @_;
 
+  $::auth->assert('email_journal');
+
   if ( $::instance_conf->get_email_journal == 0 ) {
     flash('info',  $::locale->text('Storing the emails in the journal is currently disabled in the client configuration.'));
   }
@@ -39,6 +41,8 @@ sub action_list {
 sub action_show {
   my ($self) = @_;
 
+  $::auth->assert('email_journal');
+
   my $back_to = $::form->{back_to} || $self->url_for(action => 'list');
 
   $self->entry(SL::DB::EmailJournal->new(id => $::form->{id})->load);
@@ -55,6 +59,8 @@ sub action_show {
 sub action_download_attachment {
   my ($self) = @_;
 
+  $::auth->assert('email_journal');
+
   my $attachment = SL::DB::EmailJournalAttachment->new(id => $::form->{id})->load;
 
   if (!$self->can_view_all && ($attachment->email_journal->sender_id != SL::DB::Manager::Employee->current->id)) {
@@ -80,7 +86,7 @@ sub add_stylesheet {
 # helpers
 #
 
-sub init_can_view_all { $::auth->assert('admin', 1) }
+sub init_can_view_all { $::auth->assert('email_employee_readall', 1) }
 
 sub init_models {
   my ($self) = @_;
diff --git a/image/icons/svg/mail_journal.svg b/image/icons/svg/mail_journal.svg
new file mode 100644 (file)
index 0000000..07a2866
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 16.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   version="1.1"
+   id="Layer_1"
+   x="0px"
+   y="0px"
+   width="16"
+   height="16"
+   viewBox="0 0 16 16"
+   enable-background="new 0 0 94.398 54.766"
+   xml:space="preserve"
+   inkscape:version="0.48.1 "
+   sodipodi:docname="mail.svg"
+   inkscape:export-filename="O:\15-Artwork\Icons\od\erp\menuv3\SVG\16\mail.png"
+   inkscape:export-xdpi="14.4"
+   inkscape:export-ydpi="14.4"><metadata
+   id="metadata9"><rdf:RDF><cc:Work
+       rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+         rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+   id="defs7" /><sodipodi:namedview
+   pagecolor="#ffffff"
+   bordercolor="#666666"
+   borderopacity="1"
+   objecttolerance="10"
+   gridtolerance="10"
+   guidetolerance="10"
+   inkscape:pageopacity="0"
+   inkscape:pageshadow="2"
+   inkscape:window-width="1920"
+   inkscape:window-height="1018"
+   id="namedview5"
+   showgrid="false"
+   inkscape:zoom="28.449018"
+   inkscape:cx="13.275149"
+   inkscape:cy="11.042062"
+   inkscape:window-x="1358"
+   inkscape:window-y="-8"
+   inkscape:window-maximized="1"
+   inkscape:current-layer="Layer_1" />
+<path
+   d="m 15.499029,4.4687988 c -3.18e-4,-0.024312 -0.0038,-0.048942 -0.0073,-0.073254 -0.0024,-0.017161 -0.0033,-0.035117 -0.0071,-0.051802 -0.0044,-0.020816 -0.01224,-0.040838 -0.01891,-0.061177 -0.0064,-0.019545 -0.01176,-0.039408 -0.02002,-0.05784 -0.0073,-0.016526 -0.01732,-0.031939 -0.02606,-0.048147 -0.01144,-0.020975 -0.02256,-0.042268 -0.03639,-0.061654 -0.0025,-0.00334 -0.0037,-0.00715 -0.0062,-0.010487 -0.0089,-0.011918 -0.0197,-0.021293 -0.02924,-0.032416 -0.01494,-0.017479 -0.02956,-0.035435 -0.04624,-0.051007 -0.01478,-0.014142 -0.03051,-0.026219 -0.04672,-0.038613 -0.01653,-0.012871 -0.03242,-0.025742 -0.04989,-0.037024 -0.01732,-0.010805 -0.03591,-0.020022 -0.05387,-0.029238 -0.01843,-0.00953 -0.03671,-0.018909 -0.05625,-0.026537 -0.01923,-0.00747 -0.03909,-0.012712 -0.05895,-0.018274 -0.01955,-0.0054 -0.03893,-0.011282 -0.05927,-0.014937 -0.02288,-0.00413 -0.04576,-0.0054 -0.06881,-0.00699 -0.01462,-0.00111 -0.02844,-0.00445 -0.04322,-0.00445 H 1.1356059 c -0.014619,0 -0.028126,0.00334 -0.042427,0.00429 -0.0232,0.00159 -0.046717,0.00286 -0.069599,0.00699 -0.020022,0.00365 -0.038772,0.00938 -0.0579991,0.014619 -0.0204983,0.00572 -0.0408377,0.011123 -0.0605415,0.01875 -0.0187504,0.00747 -0.0365473,0.016526 -0.0543443,0.025583 -0.0189093,0.00953 -0.0376596,0.01875 -0.0557744,0.030191 -0.0170025,0.010964 -0.0325748,0.023517 -0.048306,0.035753 -0.0165258,0.012871 -0.0330515,0.025424 -0.0484649,0.040043 -0.0163669,0.015731 -0.030668,0.033052 -0.0452869,0.050372 -0.009693,0.011282 -0.0208161,0.020816 -0.0297146,0.032893 -0.002384,0.00334 -0.003814,0.00699 -0.006197,0.010487 -0.0138244,0.019386 -0.0246297,0.04052 -0.0362295,0.061495 -0.008898,0.016208 -0.0187504,0.031621 -0.0260598,0.048147 -0.008263,0.018592 -0.0135066,0.038454 -0.0200216,0.05784 -0.006674,0.020339 -0.0143011,0.04052 -0.0189093,0.061336 C 0.512076,4.3604258 0.510964,4.3782228 0.50858,4.3955428 0.505243,4.4198548 0.501747,4.4441668 0.501271,4.4687968 0.50111231,4.4727713 0.5,4.476585 0.5,4.4805575 v 7.4311865 c 0,0.351014 0.28459255,0.635606 0.6356059,0.635606 H 14.864376 c 0.351014,0 0.635606,-0.284592 0.635606,-0.635606 V 4.4805575 c 1.59e-4,-0.00397 -7.94e-4,-0.00779 -9.53e-4,-0.011759 z M 12.924189,5.1161634 7.9999912,8.7302188 3.0759521,5.1161634 H 12.924189 z M 1.771212,11.27598 V 5.7354025 l 5.8526594,4.2957425 c 0.1120255,0.08199 0.2440727,0.12299 0.3761198,0.12299 0.1318882,0 0.2639353,-0.04131 0.3759609,-0.12299 L 14.22877,5.7354025 V 11.27598 H 1.771212 z"
+   id="path3"
+   inkscape:connector-curvature="0"
+   style="fill:#505050;fill-opacity:1" />
+</svg>
\ No newline at end of file
index 7e89c20..cfc1635 100644 (file)
@@ -1043,7 +1043,8 @@ $self->{texts} = {
   'Duplicate in CSV file'       => 'Duplikat in CSV-Datei',
   'Duplicate in database'       => 'Duplikat in Datenbank',
   'During the next update a taxkey 0 with tax rate of 0 will automatically created.' => 'Beim nächsten Ausführen des Updates wird ein Steuerschlüssel 0 mit einem Steuersatz von 0% automatisch erzeugt.',
-  'E-Mail is sent to #1'        => 'E-Mail wurde an #1 gesendet',
+  'E-Mail is sent to #1'        => 'Die E-Mail wurde an \'#1\' gesendet',
+  'E-Mail-Journal'              => 'E-Mail-Journal',
   'E-mail'                      => 'E-Mail',
   'E-mail Statement to'         => 'Fälligkeitsabrechnung als E-Mail an',
   'E-mail address missing!'     => 'E-Mail-Adresse fehlt!',
index 1b99707..ced4c58 100644 (file)
   name: Email journal
   order: 200
   module: controller.pl
+  icon: mail_journal
   params:
     action: EmailJournal/list
 - id: system
diff --git a/sql/Pg-upgrade2-auth/mail_journal_rights.pl b/sql/Pg-upgrade2-auth/mail_journal_rights.pl
new file mode 100644 (file)
index 0000000..7d2bacb
--- /dev/null
@@ -0,0 +1,34 @@
+# @tag: mail_journal_rights
+# @description:  Extra right for email journal
+# @depends: master_rights_position_gaps
+# @locales: E-Mail-Journal
+# @locales: Read all employee e-mails
+
+package SL::DBUpgrade2::mail_journal_rights;
+
+use strict;
+use utf8;
+
+use parent qw(SL::DBUpgrade2::Base);
+
+use SL::DBUtils;
+
+sub run {
+  my ($self) = @_;
+
+  $self->db_query("INSERT INTO auth.master_rights (position, name, description) VALUES (?, ?, ?)", bind => $_) for
+    [ 4450, 'email_journal'         , 'E-Mail-Journal'            ],
+    [ 4480, 'email_employee_readall', 'Read all employee e-mails' ];
+
+  my $groups = $main::auth->read_groups();
+
+  foreach my $group (values %{$groups}) {
+    $group->{rights}->{email_journal}          = $group->{rights}->{productivity};
+    $group->{rights}->{email_employee_readall} = $group->{rights}->{admin};
+    $main::auth->save_group($group);
+  }
+
+  return 1;
+} # end run
+
+1;