From: Jan Büren Date: Tue, 23 May 2017 08:56:57 +0000 (+0200) Subject: erledigt #246 Recht: Entwürfe von anderen Benutzern bearbeiten X-Git-Tag: release-3.5.4~1072 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=dd97f9fcbdfc32d1d5508e575ad5f691cbc02244;p=kivitendo-erp.git erledigt #246 Recht: Entwürfe von anderen Benutzern bearbeiten --- diff --git a/SL/Controller/Draft.pm b/SL/Controller/Draft.pm index 6c0110ab3..ed2f602ce 100644 --- a/SL/Controller/Draft.pm +++ b/SL/Controller/Draft.pm @@ -132,7 +132,16 @@ sub _build_form { sub draft_list { my ($self) = @_; - my $result = selectall_hashref_query($::form, $::form->get_standard_dbh, <module, $self->submodule, SL::DB::Manager::Employee->current->id); + if ($::auth->assert('all_drafts_edit', 1)) { + my $result = selectall_hashref_query($::form, $::form->get_standard_dbh, <module, $self->submodule); + SELECT d.*, date(d.itime) AS date + FROM drafts d + WHERE (d.module = ?) + AND (d.submodule = ?) + ORDER BY d.itime +SQL + } else { + my $result = selectall_hashref_query($::form, $::form->get_standard_dbh, <module, $self->submodule, SL::DB::Manager::Employee->current->id); SELECT d.*, date(d.itime) AS date FROM drafts d WHERE (d.module = ?) @@ -140,6 +149,7 @@ sub draft_list { AND (d.employee_id = ?) ORDER BY d.itime SQL + } } sub dialog_html { diff --git a/locale/de/all b/locale/de/all index b89dd57fe..5d7fca44f 100755 --- a/locale/de/all +++ b/locale/de/all @@ -1106,6 +1106,7 @@ $self->{texts} = { 'Edit Warehouse' => 'Lager bearbeiten', 'Edit acceptance status' => 'Abnahmestatus bearbeiten', 'Edit additional articles' => 'Zusätzliche Artikel bearbeiten', + 'Edit all drafts' => 'Entwürfe von allen Benutzern bearbeiten', 'Edit article/section assignments' => 'Zuweisung Artikel/Abschnitte bearbeiten', 'Edit assignment of articles to sections' => 'Zuweisung Artikel zu Abschnitten bearbeiten', 'Edit background job' => 'Hintergrund-Job bearbeiten', diff --git a/sql/Pg-upgrade2-auth/all_drafts_edit.pl b/sql/Pg-upgrade2-auth/all_drafts_edit.pl new file mode 100644 index 000000000..5ee5b5e53 --- /dev/null +++ b/sql/Pg-upgrade2-auth/all_drafts_edit.pl @@ -0,0 +1,31 @@ +# @tag: all_drafts_edit +# @description: Zugriffsrecht auf alle Entwürfe +# @depends: release_3_4_0 +# @locales: Edit all drafts +# @ignore: 0 +package SL::DBUpgrade2::Auth::all_drafts_edit; + +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 + [ 5000, 'all_drafts_edit', 'Edit all drafts' ]; + + my $groups = $main::auth->read_groups(); + + foreach my $group (values %{$groups}) { + $group->{rights}->{all_drafts_edit} = $group->{rights}->{email_employee_readall}; + $main::auth->save_group($group); + } + + return 1; +} # end run + +1;