Bugzilla – Attachment 27281 Details for
Bug 12098
User can edit some subcriptions he should be prevented to
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12080: Refactor can_*_subscription in C4::Serials
Bug-12080-Refactor-cansubscription-in-C4Serials.patch (text/plain), 3.49 KB, created by
Kyle M Hall (khall)
on 2014-04-18 11:38:36 UTC
(
hide
)
Description:
Bug 12080: Refactor can_*_subscription in C4::Serials
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-04-18 11:38:36 UTC
Size:
3.49 KB
patch
obsolete
>From 16c12e21a4ddf1d8225abe777a6d8866933f885e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 16 Apr 2014 16:58:36 +0200 >Subject: [PATCH] Bug 12080: Refactor can_*_subscription in C4::Serials > >http://bugs.koha-community.org/show_bug.cgi?id=12098 >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Serials.pm | 49 +++++++++++++++++-------------------------------- > 1 files changed, 17 insertions(+), 32 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index f1add58..64fcf38 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -2840,45 +2840,30 @@ sub subscriptionCurrentlyOnOrder { > > $can = can_edit_subscription( $subscriptionid[, $userid] ); > >-Return 1 if the subscription is editable by the current logged user (or a given $userid), else 0. >+Return 1 if the subscription can be edited by the current logged user (or a given $userid), else 0. > > =cut > > sub can_edit_subscription { > my ( $subscription, $userid ) = @_; >- return 0 unless C4::Context->userenv; >- my $flags = C4::Context->userenv->{flags}; >- $userid ||= C4::Context->userenv->{'id'}; >- >- if ( C4::Context->preference('IndependentBranches') ) { >- return 1 >- if C4::Context->IsSuperLibrarian() >- or >- C4::Auth::haspermission( $userid, { serials => 'superserials' } ) >- or ( >- C4::Auth::haspermission( $userid, >- { serials => 'edit_subscription' } ) >- and ( not defined $subscription->{branchcode} >- or $subscription->{branchcode} eq '' >- or $subscription->{branchcode} eq >- C4::Context->userenv->{'branch'} ) >- ); >- } >- else { >- return 1 >- if C4::Context->IsSuperLibrarian() >- or >- C4::Auth::haspermission( $userid, { serials => 'superserials' } ) >- or C4::Auth::haspermission( >- $userid, { serials => 'edit_subscription' } >- ), >- ; >- } >- return 0; >+ return _can_do_on_subscription( $subscription, $userid, 'edit_subscription' ); > } > >+=head2 can_show_subscription >+ >+ $can = can_show_subscription( $subscriptionid[, $userid] ); >+ >+Return 1 if the subscription can be shown by the current logged user (or a given $userid), else 0. >+ >+=cut >+ > sub can_show_subscription { > my ( $subscription, $userid ) = @_; >+ return _can_do_on_subscription( $subscription, $userid, '*' ); >+} >+ >+sub _can_do_on_subscription { >+ my ( $subscription, $userid, $permission ) = @_; > return 0 unless C4::Context->userenv; > my $flags = C4::Context->userenv->{flags}; > $userid ||= C4::Context->userenv->{'id'}; >@@ -2890,7 +2875,7 @@ sub can_show_subscription { > C4::Auth::haspermission( $userid, { serials => 'superserials' } ) > or ( > C4::Auth::haspermission( $userid, >- { serials => '*' } ) >+ { serials => $permission } ) > and ( not defined $subscription->{branchcode} > or $subscription->{branchcode} eq '' > or $subscription->{branchcode} eq >@@ -2903,7 +2888,7 @@ sub can_show_subscription { > or > C4::Auth::haspermission( $userid, { serials => 'superserials' } ) > or C4::Auth::haspermission( >- $userid, { serials => '*' } >+ $userid, { serials => $permission } > ), > ; > } >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12098
:
27242
|
27243
|
27280
|
27281
|
27290
|
27291