Bugzilla – Attachment 29573 Details for
Bug 1861
Unique patrons logins not (totally) enforced
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 1861 - Unique patrons logins not (totally) enforced
Bug-1861---Unique-patrons-logins-not-totally-enfor.patch (text/plain), 2.44 KB, created by
Kyle M Hall (khall)
on 2014-07-08 13:53:07 UTC
(
hide
)
Description:
Bug 1861 - Unique patrons logins not (totally) enforced
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-07-08 13:53:07 UTC
Size:
2.44 KB
patch
obsolete
>From a039ffb98fd554fa0b98016611a4d6e8e7bbffdb Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 8 Jul 2014 09:50:08 -0400 >Subject: [PATCH] Bug 1861 - Unique patrons logins not (totally) enforced > >The Koha 3.0 patron admin page will prevent you from creating a user who >has an identical OPAC login as someone else (though I would change the >error message from "Login/password already exists." to "Login >already exists.", since it's not the password that's the >problem). > >However, there's nothing enforced in the MySQL database to prevent >patrons from being imported or manually inserted with duplicate logins. >Would it be better to change the MySQL spec from this: >KEY `userid` (`userid`) >to this: >UNIQUE KEY `userid` (`userid`) > >Test plan: >1) Enter mysql console >2) Attempt to create two borrowers with identical user id's >3) Note you are able to do so >4) Delete these bororwers >5) Apply this patch >6) Run updatedatabase.pl >7) Repeat step 2 >8) Note you are now unable to do so >--- > installer/data/mysql/kohastructure.sql | 2 +- > installer/data/mysql/updatedatabase.pl | 12 ++++++++++++ > 2 files changed, 13 insertions(+), 1 deletions(-) > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index b46dc6a..e146d4a 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -269,7 +269,7 @@ CREATE TABLE `borrowers` ( -- this table includes information about your patrons > PRIMARY KEY `borrowernumber` (`borrowernumber`), > KEY `categorycode` (`categorycode`), > KEY `branchcode` (`branchcode`), >- KEY `userid` (`userid`), >+ UNIQUE KEY `userid` (`userid`), > KEY `guarantorid` (`guarantorid`), > KEY `surname_idx` (`surname`(255)), > KEY `firstname_idx` (`firstname`(255)), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 1030454..e3391f3 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -8570,6 +8570,18 @@ if ( CheckVersion($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.17.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do(q{ >+ ALTER TABLE borrowers >+ DROP INDEX userid , >+ ADD UNIQUE userid (userid) >+ }); >+ >+ print "Upgrade to $DBversion done (Bug 1861 - Unique patrons logins not (totally) enforced)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >-- >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 1861
:
29573
|
29616
|
30561
|
30828
|
33143
|
33144
|
33749
|
33750
|
33751
|
33752
|
33983
|
33984
|
33985
|
34820
|
34821
|
34822
|
34823