adding demo mode

This commit is contained in:
tipaul 2003-08-06 12:38:27 +00:00
parent db8f840838
commit b42279581b

View file

@ -45,7 +45,7 @@ C4::Auth - Authenticates Koha users
my $query = new CGI;
my ($template, $borrowernumber, $cookie)
my ($template, $borrowernumber, $cookie)
= get_template_and_user({template_name => "opac-main.tmpl",
query => $query,
type => "opac",
@ -367,6 +367,11 @@ sub checkpw {
# Koha superuser account
return 2;
}
if ($userid eq 'demo' && $password eq 'demo' && C4::Context->config('demo')) {
# DEMO => the demo user is allowed to do everything (if demo set to 1 in koha.conf
# some features won't be effective : modify systempref, modify MARC structure,
return 2;
}
return 0;
}
@ -401,6 +406,10 @@ sub haspermission {
# Super User Account from /etc/koha.conf
$flags->{'superlibrarian'}=1;
}
if ($userid eq 'demo' && C4::Context->config('demo')) {
# Demo user that can do "anything" (demo=1 in /etc/koha.conf)
$flags->{'superlibrarian'}=1;
}
return $flags if $flags->{superlibrarian};
foreach (keys %$flagsrequired) {
return $flags if $flags->{$_};