Verteilen der Rechte für Finanzbuchhaltung auf Dialogbuchung,Kreditoren-/Debitorenrec...
authorMartin Helmling martin.helmling@octosoft.eu <martin.helmling@octosoft.eu>
Fri, 30 Sep 2016 17:40:13 +0000 (19:40 +0200)
committerMartin Helmling martin.helmling@octosoft.eu <martin.helmling@octosoft.eu>
Wed, 12 Oct 2016 16:25:31 +0000 (18:25 +0200)
Es werden drei neue Rechte eingeführt, die den Zugriff auf Dialogbuchungen,Kreditoren-/Debitorenrechnungen verfeinern

Das Recht für Finanzbuchhaltung wird auf diese Rechte als default kopiert

SL/Auth.pm
SL/Controller/CustomerVendor.pm
SL/Controller/Draft.pm
bin/mozilla/ar.pl
bin/mozilla/arap.pl
bin/mozilla/gl.pl
bin/mozilla/rp.pl
bin/mozilla/vk.pl
doc/changelog
menus/user/00-erp.yaml
sql/Pg-upgrade2-auth/split_transaction_rights.pl [new file with mode: 0644]

index 5d0b3c8..e8d6c72 100644 (file)
@@ -936,7 +936,7 @@ sub all_rights_full {
   my ($self) = @_;
 
   @{ $self->{master_rights} ||= do {
-      $self->dbconnect->selectall_arrayref("SELECT name, description, category FROM auth.master_rights ORDER BY id");
+      $self->dbconnect->selectall_arrayref("SELECT name, description, category FROM auth.master_rights ORDER BY position");
     }
   }
 }
index b2e32e6..d12fc6e 100644 (file)
@@ -263,7 +263,8 @@ sub action_save_and_close {
 sub _transaction {
   my ($self, $script) = @_;
 
-  $::auth->assert('general_ledger         | invoice_edit         | vendor_invoice_edit | ' .
+  $::auth->assert('gl_transactions | ap_transactions | ar_transactions'.
+                    '| invoice_edit         | vendor_invoice_edit | ' .
                  ' request_quotation_edit | sales_quotation_edit | sales_order_edit    | purchase_order_edit');
 
   $self->_save();
@@ -287,7 +288,7 @@ sub _transaction {
 sub action_save_and_ar_transaction {
   my ($self) = @_;
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ar_transactions');
 
   $self->_transaction('ar.pl');
 }
@@ -295,7 +296,7 @@ sub action_save_and_ar_transaction {
 sub action_save_and_ap_transaction {
   my ($self) = @_;
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ap_transactions');
 
   $self->_transaction('ap.pl');
 }
index 3f03f2c..41c8c16 100644 (file)
@@ -164,7 +164,7 @@ sub init_draft {
 }
 
 sub check_auth {
-  $::auth->assert('vendor_invoice_edit | invoice_edit | general_ledger');
+  $::auth->assert('vendor_invoice_edit | invoice_edit | ap_transactions | ar_transactions');
 }
 
 1;
index 1b59d78..6c4dcb8 100644 (file)
@@ -81,7 +81,7 @@ use strict;
 sub add {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ar_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -108,7 +108,7 @@ sub add {
 sub edit {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ar_transactions');
 
   my $form     = $main::form;
 
@@ -127,7 +127,7 @@ sub edit {
 sub display_form {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ar_transactions');
 
   my $form     = $main::form;
 
@@ -146,7 +146,7 @@ sub _retrieve_invoice_object {
 sub create_links {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ar_transactions');
 
   my %params   = @_;
   my $form     = $main::form;
@@ -216,7 +216,7 @@ sub create_links {
 sub form_header {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ar_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -476,7 +476,7 @@ sub form_header {
 sub form_footer {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ar_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -513,7 +513,7 @@ sub form_footer {
 sub mark_as_paid {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ar_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -526,7 +526,7 @@ sub mark_as_paid {
 sub update {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ar_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -616,7 +616,7 @@ sub update {
 sub post_payment {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ar_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -666,7 +666,7 @@ sub post_payment {
 
 sub _post {
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ar_transactions');
 
   my $form     = $main::form;
 
@@ -677,7 +677,7 @@ sub _post {
 sub post {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ar_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -767,7 +767,7 @@ sub post {
 sub post_as_new {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ar_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -789,7 +789,7 @@ sub post_as_new {
 sub use_as_new {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ar_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -806,7 +806,7 @@ sub use_as_new {
 sub delete {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ar_transactions');
 
   my $form     = $main::form;
   my $locale   = $main::locale;
@@ -845,7 +845,7 @@ sub delete {
 sub yes {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ar_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -1187,7 +1187,7 @@ sub ar_transactions {
 sub storno {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('ar_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
index 29cad39..f900970 100644 (file)
@@ -53,7 +53,7 @@ sub check_name {
   my %myconfig = %main::myconfig;
   my $locale   = $main::locale;
 
-  $main::auth->assert('general_ledger               | vendor_invoice_edit       | sales_order_edit    | invoice_edit |' .
+  $main::auth->assert('ar_transactions | ap_transactions | vendor_invoice_edit       | sales_order_edit    | invoice_edit |' .
                 'request_quotation_edit       | sales_quotation_edit      | purchase_order_edit | cash         |' .
                 'purchase_delivery_order_edit | sales_delivery_order_edit');
 
@@ -152,7 +152,7 @@ sub select_name {
   my $form     = $main::form;
   my $locale   = $main::locale;
 
-  $main::auth->assert('general_ledger         | vendor_invoice_edit  | sales_order_edit    | invoice_edit | sales_delivery_order_edit |' .
+  $main::auth->assert('ar_transactions| ap_transactions | vendor_invoice_edit  | sales_order_edit    | invoice_edit | sales_delivery_order_edit |' .
                 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash');
 
   my ($table) = @_;
@@ -260,7 +260,7 @@ sub name_selected {
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
 
-  $main::auth->assert('general_ledger         | vendor_invoice_edit  | sales_order_edit    | invoice_edit | sales_delivery_order_edit | ' .
+  $main::auth->assert('ar_transactions | ap_transactions | vendor_invoice_edit  | sales_order_edit    | invoice_edit | sales_delivery_order_edit | ' .
                 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash');
 
   # replace the variable with the one checked
@@ -302,7 +302,7 @@ sub _reset_salesman_id {
 sub select_project {
   $::lxdebug->enter_sub;
 
-  $::auth->assert('general_ledger         | vendor_invoice_edit  | sales_order_edit    | invoice_edit |' .
+  $::auth->assert('ar_transactions | ap_transactions | vendor_invoice_edit  | sales_order_edit    | invoice_edit |' .
                   'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash         | report');
 
   my ($is_global, $nextsub) = @_;
@@ -329,7 +329,7 @@ sub project_selected {
 
   my $form     = $main::form;
 
-  $main::auth->assert('general_ledger         | vendor_invoice_edit  | sales_order_edit    | invoice_edit |' .
+  $main::auth->assert('ar_transactions  | ap_transactions    | vendor_invoice_edit  | sales_order_edit    | invoice_edit |' .
                 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash         | report');
 
   # replace the variable with the one checked
index ea94a28..42ac4a0 100644 (file)
@@ -78,7 +78,7 @@ require "bin/mozilla/reportgenerator.pl";
 sub add {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('gl_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -118,7 +118,7 @@ sub add {
 sub prepare_transaction {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('gl_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -189,7 +189,7 @@ sub prepare_transaction {
 sub edit {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('gl_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -210,7 +210,7 @@ sub edit {
 
 sub search {
   $::lxdebug->enter_sub;
-  $::auth->assert('general_ledger');
+  $::auth->assert('gl_transactions');
 
   $::form->all_departments(\%::myconfig);
   $::form->get_lists(
@@ -249,7 +249,7 @@ sub create_subtotal_row {
 sub generate_report {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('gl_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -513,7 +513,7 @@ sub generate_report {
 sub update {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('gl_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -621,7 +621,7 @@ sub display_form {
   my ($init) = @_;
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('gl_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -644,7 +644,7 @@ sub display_rows {
   my ($init) = @_;
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('gl_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -848,7 +848,7 @@ sub _get_radieren {
 
 sub form_header {
   $::lxdebug->enter_sub;
-  $::auth->assert('general_ledger');
+  $::auth->assert('gl_transactions');
 
   my ($init) = @_;
 
@@ -896,7 +896,7 @@ sub form_header {
 
 sub form_footer {
   $::lxdebug->enter_sub;
-  $::auth->assert('general_ledger');
+  $::auth->assert('gl_transactions');
 
   my ($follow_ups, $follow_ups_due);
 
@@ -1147,7 +1147,7 @@ sub post_transaction {
 sub post {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('gl_transactions');
 
   my $form     = $main::form;
   my $locale   = $main::locale;
@@ -1172,7 +1172,7 @@ sub post {
 sub post_as_new {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('gl_transactions');
 
   my $form     = $main::form;
 
@@ -1185,7 +1185,7 @@ sub post_as_new {
 sub storno {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('gl_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
index 96a425d..0a1a352 100644 (file)
@@ -102,8 +102,8 @@ use strict;
 
 my $rp_access_map = {
   'projects'           => 'report',
-  'ar_aging'           => 'general_ledger',
-  'ap_aging'           => 'general_ledger',
+  'ar_aging'           => 'general_ledger | ar_transactions',
+  'ap_aging'           => 'general_ledger | ap_transactions',
   'receipts'           => 'cash',
   'payments'           => 'cash',
   'trial_balance'      => 'report',
@@ -928,7 +928,7 @@ sub list_accounts {
 sub generate_ar_aging {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('general_ledger | ar_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -951,7 +951,7 @@ sub generate_ar_aging {
 sub generate_ap_aging {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger');
+  $main::auth->assert('general_ledger | ap_transactions');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
index 7441c38..6c10f4d 100644 (file)
@@ -48,7 +48,7 @@ use strict;
 
 sub search_invoice {
   $main::lxdebug->enter_sub();
-  $main::auth->assert('general_ledger | invoice_edit');
+  $main::auth->assert('ar_transactions | ap_transactions | invoice_edit');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
@@ -92,7 +92,7 @@ sub search_invoice {
 sub invoice_transactions {
   $main::lxdebug->enter_sub();
 
-  $main::auth->assert('general_ledger | invoice_edit');
+  $main::auth->assert('ar_transactions | ap_transactions | invoice_edit');
 
   my $form     = $main::form;
   my %myconfig = %main::myconfig;
index 57d85e4..9bf0a7c 100644 (file)
@@ -6,6 +6,9 @@
 
 kleinere neue Features und Detailverbesserungen:
 
+  - Verfeinerung der Rechte für Finanzbuchhaltung: Es können nun für Dialogbuchungen,
+    Debitoren- und Kreditorenbuchungen extra Rechte vergeben werden
+
   - Weiterer Bericht in der Rubrik Lager: Lagerentnahme
     Gibt eine Statistik über Lagerbewegungen, pro Monat/Quartal/Jahr.
 
index b981290..96250db 100644 (file)
   name: Add Transaction
   icon: transaction_add
   order: 100
-  access: general_ledger
+  access: gl_transactions
   module: gl.pl
   params:
     action: add
   name: Add AR Transaction
   icon: ar_transaction_add
   order: 200
-  access: general_ledger
+  access: ar_transactions
   module: ar.pl
   params:
     action: add
   name: Add AP Transaction
   icon: ap_transaction_add
   order: 300
-  access: general_ledger
+  access: ap_transactions
   module: ap.pl
   params:
     action: add
diff --git a/sql/Pg-upgrade2-auth/split_transaction_rights.pl b/sql/Pg-upgrade2-auth/split_transaction_rights.pl
new file mode 100644 (file)
index 0000000..d6e829f
--- /dev/null
@@ -0,0 +1,40 @@
+# @tag: split_transaction_rights
+# @description: Finanzbuchhaltungsrechte für Buchungen aufspalten
+# @depends: release_3_4_0 master_rights_position_gaps
+# @charset: utf-8
+# @locales: General Ledger Transaction
+# @locales: AR Transactions
+# @locales: AP Transactions
+
+
+package SL::DBUpgrade2::split_transaction_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 (3130,'gl_transactions','General Ledger Transaction')");
+  $self->db_query("INSERT INTO auth.master_rights (position, name, description) VALUES (3150,'ar_transactions','AR Transactions')");
+  $self->db_query("INSERT INTO auth.master_rights (position, name, description) VALUES (3170,'ap_transactions','AP Transactions')");
+  $self->db_query("UPDATE auth.master_rights SET description='General Ledger' WHERE name='general_ledger'");
+
+  my $groups = $main::auth->read_groups();
+
+  foreach my $group (values %{$groups}) {
+    $group->{rights}->{gl_transactions} = $group->{rights}->{general_ledger};
+    $group->{rights}->{ar_transactions} = $group->{rights}->{general_ledger};
+    $group->{rights}->{ap_transactions} = $group->{rights}->{general_ledger};
+    $main::auth->save_group($group);
+  }
+
+  return 1;
+} # end run
+
+1;
+