From b42279581bdc0b6e9aa2cc40205635c20f57f47f Mon Sep 17 00:00:00 2001 From: tipaul Date: Wed, 6 Aug 2003 12:38:27 +0000 Subject: [PATCH] adding demo mode --- C4/Auth.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 1df5fc5564..82cd7d90cf 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -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->{$_}; -- 2.39.5