Bugzilla – Attachment 45475 Details for
Bug 9163
Cataloguing validation workflow
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
BUG 9163 - Patch2 use user permissions instead of systempreferences
BUG-9163---Patch2-use-user-permissions-instead-of-.patch (text/plain), 9.56 KB, created by
Alex Arnaud
on 2015-12-08 09:06:29 UTC
(
hide
)
Description:
BUG 9163 - Patch2 use user permissions instead of systempreferences
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2015-12-08 09:06:29 UTC
Size:
9.56 KB
patch
obsolete
>From 7466c9e96c13c3ece3a4c71cda51eaa99bf940bc Mon Sep 17 00:00:00 2001 >From: Vitor FERNANDES <vfernandes@keep.pt> >Date: Wed, 28 Nov 2012 17:25:59 +0000 >Subject: [PATCH] BUG 9163 - Patch2 use user permissions instead of > systempreferences > >New user permission added to access the validation framework, under edit catalogue section. >--- > cataloguing/addbiblio.pl | 16 ++++++------ > cataloguing/addbooks.pl | 26 +++++++++----------- > installer/data/mysql/sysprefs.sql | 1 - > installer/data/mysql/updatedatabase.pl | 2 +- > installer/data/mysql/userpermissions.sql | 1 + > .../en/modules/admin/preferences/cataloguing.pref | 5 ---- > 6 files changed, 21 insertions(+), 30 deletions(-) > >diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index 7c371d4..2c766fd 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -22,9 +22,9 @@ > use strict; > #use warnings; FIXME - Bug 2505 > use CGI q(-utf8); >-use CGI::Session; >+use C4::Members; > use C4::Output; >-use C4::Auth qw/:DEFAULT get_session/; >+use C4::Auth; > use C4::Biblio; > use C4::Search; > use C4::AuthoritiesMarc; >@@ -710,11 +710,6 @@ my $fa_branch = $input->param('branch'); > my $fa_stickyduedate = $input->param('stickyduedate'); > my $fa_duedatespec = $input->param('duedatespec'); > >-# getting userID >-my $sessionID = $input->cookie("CGISESSID") ; >-my $session = get_session($sessionID); >-my $userid = $session->param('id'); >- > # getting validation variables > my $validation = C4::Context->preference('CatalogingValidation'); > my $validationframework = C4::Context->preference('CatalogingValidationFramework'); >@@ -741,9 +736,12 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > >+my $uid = GetMember( borrowernumber => $loggedinuser )->{userid} if ($loggedinuser); >+my $validationpermission = haspermission($uid, {'editcatalogue' => 'cataloging_validation_framework'}); >+ > # Clear the framework code if validation is on and the framework code is equal to validation framework but the user is not authorized to use it > # Avoid users to user validation framework adding the code to the URL >-$frameworkcode = '' if ($validation && ($frameworkcode eq $validationframework && !$validationusers{$userid})); >+$frameworkcode = '' if ($validation && ($frameworkcode eq $validationframework && !$validationpermission)); > > if ($frameworkcode eq 'FA'){ > # We need to grab and set some variables in the template for use on the additems screen >@@ -776,7 +774,7 @@ foreach my $thisframeworkcode ( keys %$frameworks ) { > } > # Add the framework code if validation is off. > # Add the framework code if validation is on, the framework code is equal to validation framework and the user is not authorized to use it >- if (!$validation || ($validation && ($thisframeworkcode ne $validationframework || ($thisframeworkcode eq $validationframework && $validationusers{$userid})))) { >+ if (!$validation || ($validation && ($thisframeworkcode ne $validationframework || ($thisframeworkcode eq $validationframework && $validationpermission)))) { > push @frameworkcodeloop, \%row; > } > } >diff --git a/cataloguing/addbooks.pl b/cataloguing/addbooks.pl >index 1d3c2cc..35963fe 100755 >--- a/cataloguing/addbooks.pl >+++ b/cataloguing/addbooks.pl >@@ -27,8 +27,8 @@ > use strict; > use warnings; > use CGI qw ( -utf8 ); >-use CGI::Session; >-use C4::Auth qw/:DEFAULT get_session/; >+use C4::Members; >+use C4::Auth; > use C4::Biblio; > use C4::Breeding; > use C4::Output; >@@ -37,15 +37,9 @@ use C4::Search; > > my $input = new CGI; > >-# getting userID >-my $sessionID = $input->cookie("CGISESSID"); >-my $session = get_session($sessionID); >-my $userid = $session->param('id'); >- > # getting validation variables > my $validation = C4::Context->preference('CatalogingValidation'); > my $validationframework = C4::Context->preference('CatalogingValidationFramework'); >-my %validationusers = map { $_ => 1 } split(/,/,C4::Context->preference('CatalogingValidationUsers')); > > my $success = $input->param('biblioitem'); > my $query = $input->param('q'); >@@ -65,17 +59,21 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > >+my $uid = GetMember( borrowernumber => $loggedinuser )->{userid} if ($loggedinuser); >+my $validationpermission = haspermission($uid, {'editcatalogue' => 'cataloging_validation_framework'}); >+ > # get framework list > my $frameworks = getframeworks; > my @frameworkcodeloop; >-foreach my $thisframeworkcode ( sort { uc($frameworks->{$a}->{'frameworktext'}) cmp uc($frameworks->{$b}->{'frameworktext'}) } keys %{$frameworks} ) { >+foreach my $thisframeworkcode ( sort {$frameworks->{$a} cmp $frameworks->{$b}}keys %{$frameworks} ) { > # Add the framework code if validation is off. > # Add the framework code if validation is on, the framework code is equal to validation framework and the user is not authorized to use it >- if (!$validation || ($validation && ($thisframeworkcode ne $validationframework || ($thisframeworkcode eq $validationframework && $validationusers{$userid})))) { >- push @frameworkcodeloop, { >- value => $thisframeworkcode, >- frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'}, >- }; >+ if (!$validation || ($validation && ($thisframeworkcode ne $validationframework || ($thisframeworkcode eq $validationframework && $validationpermission)))) { >+ push @frameworkcodeloop, { >+ value => $thisframeworkcode, >+ frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'}, >+ }; >+ } > } > > >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 35ff2f6..c6c746f 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -89,7 +89,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('CataloguingLog','1',NULL,'If ON, log edit/create/delete actions on bibliographic data. WARNING: this feature is very resource consuming.','YesNo'), > ('CatalogingValidation','0',NULL,'Active cataloging validation','YesNo'); > ('CatalogingValidationFramework','',NULL,'Cataloging validation framework','long'); >-('CatalogingValidationUsers','',NULL,'Cataloging validation users','long'); > ('checkdigit','none','none|katipo','If ON, enable checks on patron cardnumber: none or \"Katipo\" style checks','Choice'), > ('CircAutocompl','1',NULL,'If ON, autocompletion is enabled for the Circulation input','YesNo'), > ('CircAutoPrintQuickSlip','qslip',NULL,'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window, Display a print slip window or Clear the screen.','Choice'), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index d67ec34..62b8482 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6703,7 +6703,7 @@ $DBversion = '3.11.00.XXX'; > if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CatalogingValidation', '0','Active cataloging validation',NULL,'YesNo');"); > $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CatalogingValidationFramework','','Cataloging validation framework',NULL,'long');"); >- $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CatalogingValidationUsers', '','Cataloging validation users',NULL,'long');"); >+ $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'cataloging_validation_framework', 'Access to the cataloguing validation framework');"); > print "Upgrade to $DBversion done (Bug 9163 - Cataloguing validation workflow)\n"; > SetVersion($DBversion); > } >diff --git a/installer/data/mysql/userpermissions.sql b/installer/data/mysql/userpermissions.sql >index 25d4f92..2dcc576 100644 >--- a/installer/data/mysql/userpermissions.sql >+++ b/installer/data/mysql/userpermissions.sql >@@ -14,6 +14,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > ( 9, 'edit_items', 'Edit items'), > ( 9, 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEditing preference (please note that edit_item is still required)'), > ( 9, 'delete_all_items', 'Delete all items at once'), >+ ( 9, 'cataloging_validation_framework', 'Access to the cataloguing validation framework'), > (10, 'writeoff', 'Write off fines and fees'), > (10, 'remaining_permissions', 'Remaining permissions for managing fines and fees'), > (11, 'vendors_manage', 'Manage vendors'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >index a5b6eb5..b9952cd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >@@ -260,8 +260,3 @@ Cataloging: > - pref: CatalogingValidationFramework > class: long > - "<br />NOTE:<br /> - CatalogingValidation needs to be on.<br /> - The framework needs to be created in the MARC frameworks administration panel.<br /> - The framework needs to have suppress subfield visible." >- - >- - "The following users (list comma separated) will have access to validation framework:" >- - pref: CatalogingValidationUsers >- class: long >- - "<br />NOTE:<br /> - CatalogingValidation needs to be on." >-- >1.7.10.4
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 9163
:
13737
|
13743
|
16383
|
16384
|
16525
|
16526
|
16605
|
16619
|
16675
|
19270
|
19271
|
21192
|
21194
|
45474
| 45475