Bugzilla – Attachment 56815 Details for
Bug 17459
Add a script to create a superlibrarian user
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17459: Follow up
Bug-17459-Follow-up.patch (text/plain), 3.31 KB, created by
Tomás Cohen Arazi (tcohen)
on 2016-10-24 18:01:38 UTC
(
hide
)
Description:
Bug 17459: Follow up
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2016-10-24 18:01:38 UTC
Size:
3.31 KB
patch
obsolete
>From c7ebcd4031e4f7dd8280c05abb34d124ece7d0f5 Mon Sep 17 00:00:00 2001 >From: Chris Cormack <chrisc@catalyst.net.nz> >Date: Wed, 19 Oct 2016 08:53:26 +1300 >Subject: [PATCH] Bug 17459: Follow up > >Adding POD and --userid and --password options > >1/ To test, use the same routine as before, with no options. >2/ You should have a user with koha/koha as userid and passwords >3/ Delete that user >4/ Run the script with --userid <userid> --password <password> >5/ You should have a user in koha with userid/password set > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > misc/devel/create_superlibrarian.pl | 66 +++++++++++++++++++++++++++++++++---- > 1 file changed, 60 insertions(+), 6 deletions(-) > mode change 100644 => 100755 misc/devel/create_superlibrarian.pl > >diff --git a/misc/devel/create_superlibrarian.pl b/misc/devel/create_superlibrarian.pl >old mode 100644 >new mode 100755 >index 3c8dc5d..623a01a >--- a/misc/devel/create_superlibrarian.pl >+++ b/misc/devel/create_superlibrarian.pl >@@ -17,8 +17,9 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >- > use Modern::Perl; >+use Getopt::Long; >+use Pod::Usage; > > use C4::Installer; > use C4::Context; >@@ -32,18 +33,71 @@ use Koha::Patron::Categories; > my $library = Koha::Libraries->search->next; > my $patron_category = Koha::Patron::Categories->search->next; > >-die "Not enough data in the database, library and/or patron category does not exist" >+die >+"Not enough data in the database, library and/or patron category does not exist" > unless $library and $patron_category; > >-die "A patron with userid 'koha' already exists" if Koha::Patrons->find( { userid => 'koha' } ); >-die "A patron with cardnumber '42' already exists" if Koha::Patrons->find( { cardnumber => 'koha' } ); >+die "A patron with userid 'koha' already exists" >+ if Koha::Patrons->find( { userid => 'koha' } ); >+die "A patron with cardnumber '42' already exists" >+ if Koha::Patrons->find( { cardnumber => 'koha' } ); >+ >+my $userid = 'koha'; >+my $password = 'koha'; >+my $help; >+ >+GetOptions( >+ 'help|?' => \$help, >+ 'userid=s' => \$userid, >+ 'password=s' => \$password >+); >+ >+pod2usage(1) if $help; > > AddMember( > surname => 'koha', >- userid => 'koha', >+ userid => $userid, > cardnumber => 42, > branchcode => $library->branchcode, > categorycode => $patron_category->categorycode, >- password => 'koha', >+ password => $password, > flags => 1, > ); >+ >+=head1 NAME >+ >+create_superlibrarian.pl - create a user in Koha with superlibrarian permissions >+ >+=head1 SYNOPSIS >+ >+create_superlibrarian.pl >+ [ --userid <userid> ] [ --password <password> ] >+ >+ Options: >+ -?|--help brief help message >+ --userid specify the userid to be set (defaults to koha) >+ --password specify the password to be set (defaults to koha) >+ >+=head1 OPTIONS >+ >+=over 8 >+ >+=item B<--help|-?> >+ >+Print a brief help message and exits >+ >+=item B<--userid> >+ >+Allows you to specify the userid to be set in the database >+ >+=item B<--password> >+ >+Allows you to specify the password to be set in the database >+ >+=back >+ >+=head1 DESCRIPTION >+ >+A simple script to create a user in the Koha database with superlibrarian permissions >+ >+=cut >-- >2.7.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 17459
:
56608
|
56630
|
56631
|
56632
|
56670
|
56671
|
56814
| 56815