Bugzilla – Attachment 13743 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), 14.25 KB, created by
Vitor Fernandes
on 2012-11-28 17:27:42 UTC
(
hide
)
Description:
BUG 9163 - Patch2 use user permissions instead of systempreferences
Filename:
MIME Type:
Creator:
Vitor Fernandes
Created:
2012-11-28 17:27:42 UTC
Size:
14.25 KB
patch
obsolete
>From 37e9eded5c6a607391331f3566134fcf00b962fe 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 | 17 +++++++---------- > cataloguing/addbooks.pl | 15 ++++++--------- > .../data/mysql/de-DE/mandatory/userpermissions.sql | 1 + > .../data/mysql/en/mandatory/userpermissions.sql | 1 + > .../data/mysql/es-ES/mandatory/userpermissions.sql | 1 + > .../mysql/fr-FR/1-Obligatoire/userpermissions.sql | 1 + > .../data/mysql/it-IT/necessari/userpermissions.sql | 1 + > .../mysql/nb-NO/1-Obligatorisk/userpermissions.sql | 1 + > .../data/mysql/pl-PL/mandatory/userpermissions.sql | 1 + > installer/data/mysql/sysprefs.sql | 1 - > installer/data/mysql/updatedatabase.pl | 2 +- > .../en/modules/admin/preferences/cataloguing.pref | 5 ----- > 12 files changed, 21 insertions(+), 26 deletions(-) > >diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index 03f9f87..492af11 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -22,9 +22,9 @@ > use strict; > #use warnings; FIXME - Bug 2505 > use CGI; >-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; >@@ -719,15 +719,9 @@ my $dbh = C4::Context->dbh; > my $hostbiblionumber = $input->param('hostbiblionumber'); > my $hostitemnumber = $input->param('hostitemnumber'); > >-# 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 $userflags = 'edit_catalogue'; > if ($frameworkcode eq 'FA'){ >@@ -748,9 +742,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 >@@ -775,7 +772,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 efc57f7..9f09c07 100755 >--- a/cataloguing/addbooks.pl >+++ b/cataloguing/addbooks.pl >@@ -27,8 +27,8 @@ > use strict; > use warnings; > use CGI; >-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,13 +59,16 @@ 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 {$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})))) { >+ if (!$validation || ($validation && ($thisframeworkcode ne $validationframework || ($thisframeworkcode eq $validationframework && $validationpermission)))) { > push @frameworkcodeloop, { > value => $thisframeworkcode, > frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'}, >diff --git a/installer/data/mysql/de-DE/mandatory/userpermissions.sql b/installer/data/mysql/de-DE/mandatory/userpermissions.sql >index ec5a22a..7b62c97 100644 >--- a/installer/data/mysql/de-DE/mandatory/userpermissions.sql >+++ b/installer/data/mysql/de-DE/mandatory/userpermissions.sql >@@ -8,6 +8,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > ( 9, 'edit_catalogue', 'Katalogdaten bearbeiten (Titel- und Exemplardaten ändern)'), > ( 9, 'fast_cataloging', 'Schnellaufnahmen anlegen'), > ( 9, 'edit_items', 'Exemplare bearbeiten'), >+ ( 9, 'cataloging_validation_framework', 'Access to the cataloguing validation framework'), > (11, 'vendors_manage', 'Lieferanten verwalten'), > (11, 'contracts_manage', 'Vereinbarungen verwalten'), > (11, 'period_manage', 'Etats verwalten'), >diff --git a/installer/data/mysql/en/mandatory/userpermissions.sql b/installer/data/mysql/en/mandatory/userpermissions.sql >index 070e8f5..e530eb0 100644 >--- a/installer/data/mysql/en/mandatory/userpermissions.sql >+++ b/installer/data/mysql/en/mandatory/userpermissions.sql >@@ -8,6 +8,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'), > ( 9, 'fast_cataloging', 'Fast cataloging'), > ( 9, 'edit_items', 'Edit Items'), >+ ( 9, 'cataloging_validation_framework', 'Access to the cataloguing validation framework'), > (11, 'vendors_manage', 'Manage vendors'), > (11, 'contracts_manage', 'Manage contracts'), > (11, 'period_manage', 'Manage periods'), >diff --git a/installer/data/mysql/es-ES/mandatory/userpermissions.sql b/installer/data/mysql/es-ES/mandatory/userpermissions.sql >index 070e8f5..e530eb0 100644 >--- a/installer/data/mysql/es-ES/mandatory/userpermissions.sql >+++ b/installer/data/mysql/es-ES/mandatory/userpermissions.sql >@@ -8,6 +8,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'), > ( 9, 'fast_cataloging', 'Fast cataloging'), > ( 9, 'edit_items', 'Edit Items'), >+ ( 9, 'cataloging_validation_framework', 'Access to the cataloguing validation framework'), > (11, 'vendors_manage', 'Manage vendors'), > (11, 'contracts_manage', 'Manage contracts'), > (11, 'period_manage', 'Manage periods'), >diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql b/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql >index 3147bed..753f149 100644 >--- a/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql >+++ b/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql >@@ -8,6 +8,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > ( 9, 'edit_catalogue', 'Ajouter et modifier des notices au catalogue'), > ( 9, 'fast_cataloging', 'Catalogage rapide'), > ( 9, 'edit_items', 'Modifier des exemplaires'), >+ ( 9, 'cataloging_validation_framework', 'Access to the cataloguing validation framework'), > (13, 'edit_news', 'Ecrire des nouvelles pour l''OPAC et l''interface professionnelle'), > (13, 'label_creator', 'Créer des étiquettes à partir des données du catalogues et des adhérents'), > (13, 'edit_calendar', 'Définir les jours de fermeture de la bibliothèque'), >diff --git a/installer/data/mysql/it-IT/necessari/userpermissions.sql b/installer/data/mysql/it-IT/necessari/userpermissions.sql >index d0b5348..b575ed9 100644 >--- a/installer/data/mysql/it-IT/necessari/userpermissions.sql >+++ b/installer/data/mysql/it-IT/necessari/userpermissions.sql >@@ -10,6 +10,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > ( 9, 'edit_catalogue', 'Cataloga (crea/modifica dati bibliografici e di copia)'), > ( 9, 'fast_cataloging', 'Catalogazione veloce'), > ( 9, 'edit_items', 'Crea/modifica copie'), >+ ( 9, 'cataloging_validation_framework', 'Access to the cataloguing validation framework'), > (11, 'vendors_manage', 'Crea/modifica fornitori'), > (11, 'contracts_manage', 'Crea/modifica contratti'), > (11, 'period_manage', 'Gestisci scadenze budgets'), >diff --git a/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql b/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql >index 36c03f3..fcd3bc1 100644 >--- a/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql >+++ b/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql >@@ -28,6 +28,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > ( 9, 'edit_catalogue', 'Endre katalogen (Endre bibliografiske poster og eksemplaropplysninger)'), > ( 9, 'fast_cataloging', 'Hurtigkatalogisering'), > ( 9, 'edit_items', 'Endre eksmeplarer'), >+ ( 9, 'cataloging_validation_framework', 'Access to the cataloguing validation framework'), > (11, 'vendors_manage', 'Administrere leverandører'), > (11, 'contracts_manage', 'Administrere kontrakter'), > (11, 'period_manage', 'Administrere perioder'), >diff --git a/installer/data/mysql/pl-PL/mandatory/userpermissions.sql b/installer/data/mysql/pl-PL/mandatory/userpermissions.sql >index 1165af1..30849cb 100644 >--- a/installer/data/mysql/pl-PL/mandatory/userpermissions.sql >+++ b/installer/data/mysql/pl-PL/mandatory/userpermissions.sql >@@ -8,6 +8,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > ( 9, 'edit_catalogue', 'Edit catalogue'), > ( 9, 'fast_cataloging', 'Szybkie katalogowanie'), > ( 9, 'edit_items', 'Edit Items'), >+ ( 9, 'cataloging_validation_framework', 'Access to the cataloguing validation framework'), > (11, 'vendors_manage', 'ZarzÄdzanei dostawcami'), > (11, 'contracts_manage', 'ZarzÄdzanie kontraktami'), > (11, 'period_manage', 'Manage periods'), >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 8a84c46..94d17c2 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -389,4 +389,3 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('alphabet','A B C D E F G H I J K L M N O P Q R S T U V W X Y Z','Alphabet than can be expanded into browse links, e.g. on Home > Patrons',NULL,'free'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CatalogingValidation', '0','Active cataloging validation',NULL,'YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CatalogingValidationFramework','','Cataloging validation framework',NULL,'long'); >-INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('CatalogingValidationUsers', '','Cataloging validation users',NULL,'long'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 11fe365..a02611e 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6087,7 +6087,7 @@ $DBversion = "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/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >index bf98eb7..eb39be9 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 >@@ -169,8 +169,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.9.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 9163
:
13737
|
13743
|
16383
|
16384
|
16525
|
16526
|
16605
|
16619
|
16675
|
19270
|
19271
|
21192
|
21194
|
45474
|
45475