3 # This file is part of Koha.
5 # Copyright 2016 Koha Development Team
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
31 use Koha
::Patron
::Categories
;
33 my $library = Koha
::Libraries
->search->next;
34 my $patron_category = Koha
::Patron
::Categories
->search->next;
37 "Not enough data in the database, library and/or patron category does not exist"
38 unless $library and $patron_category;
40 die "A patron with userid 'koha' already exists"
41 if Koha
::Patrons
->find( { userid
=> 'koha' } );
42 die "A patron with cardnumber '42' already exists"
43 if Koha
::Patrons
->find( { cardnumber
=> 'koha' } );
46 my $password = 'koha';
51 'userid=s' => \
$userid,
52 'password=s' => \
$password
55 pod2usage
(1) if $help;
61 branchcode
=> $library->branchcode,
62 categorycode
=> $patron_category->categorycode,
63 password
=> $password,
69 create_superlibrarian.pl - create a user in Koha with superlibrarian permissions
73 create_superlibrarian.pl
74 [ --userid <userid> ] [ --password <password> ]
77 -?|--help brief help message
78 --userid specify the userid to be set (defaults to koha)
79 --password specify the password to be set (defaults to koha)
87 Print a brief help message and exits
91 Allows you to specify the userid to be set in the database
95 Allows you to specify the password to be set in the database
101 A simple script to create a user in the Koha database with superlibrarian permissions