Skip to content
Browse files

adding authentification with Auth.pm

  • Loading branch information...
1 parent 92821ae commit 9d54a6437b2d10470ea58a4088a86f51aa0ee918 tipaul committed Dec 13, 2002
Showing with 106 additions and 37 deletions.
  1. +14 −5 boraccount.pl
  2. +13 −4 jmemberentry.pl
  3. +11 −2 mancredit.pl
  4. +12 −3 maninvoice.pl
  5. +10 −2 member.pl
  6. +10 −2 memberentry.pl
  7. +8 −6 members-home.pl
  8. +10 −2 moremember.pl
  9. +10 −6 readingrec.pl
  10. +8 −5 reports-home.pl
View
19 boraccount.pl
@@ -24,6 +24,7 @@
# Suite 330, Boston, MA 02111-1307 USA
use strict;
+use C4::Auth;
use C4::Output;
use CGI;
use C4::Search;
@@ -32,8 +33,16 @@
my $input=new CGI;
my $theme = $input->param('theme'); # only used if allowthemeoverride is set
-my %tmpldata = pathtotemplate ( template => 'boraccount.tmpl', theme => $theme );
-my $template = HTML::Template->new(filename => $tmpldata{'path'}, die_on_bad_params => 0);
+#my %tmpldata = pathtotemplate ( template => 'boraccount.tmpl', theme => $theme );
+#my $template = HTML::Template->new(filename => $tmpldata{'path'}, die_on_bad_params => 0);
+my ($template, $loggedinuser, $cookie)
+ = get_template_and_user({template_name => "boraccount.tmpl",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {borrowers => 1},
+ debug => 1,
+ });
my $bornum=$input->param('bornum');
#get borrower details
@@ -62,12 +71,12 @@
push(@accountrows, \%row);
}
-$template->param( startmenumember => startmenu('member'),
- endmenumember => endmenu('member'),
+$template->param( startmenumember => join('', startmenu('member')),
+ endmenumember => join('', endmenu('member')),
firstname => $data->{'firstname'},
surname => $data->{'surname'},
bornum => $bornum,
total => $total,
accounts => \@accountrows );
-print "Content-Type: text/html\n\n", $template->output;
+print $input->header(-cookie => $cookie),$template->output;
View
17 jmemberentry.pl
@@ -22,14 +22,22 @@
# Suite 330, Boston, MA 02111-1307 USA
use strict;
+use C4::Auth;
use C4::Output;
use CGI;
use C4::Search;
use HTML::Template;
my $input = new CGI;
-my $template = gettemplate("members/jmemberentry.tmpl");
+my ($template, $loggedinuser, $cookie)
+ = get_template_and_user({template_name => "members/jmemberentry.tmpl",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {borrowers => 1},
+ debug => 1,
+ });
my $member=$input->param('bornum');
if ($member eq ''){
@@ -65,9 +73,10 @@
}
-$template->param( startmenumember => startmenu('member'),
+$template->param( startmenumember => join('', startmenu('member')),
+ endmenumember => join('', endmenu('member')),
endmenumember => endmenu('member'),
- member => $member,
+ member => $member,
firstname => $data->{'firstname'},
surname => $data->{'surname'},
cardnumber => $data->{'cardnumber'},
@@ -85,4 +94,4 @@
titleloop => \@titledata,
cmemloop => \@cmemdata );
-print "Content-Type: text/html\n\n", $template->output;
+print $input->header(-cookie => $cookie),$template->output;
View
13 mancredit.pl
@@ -22,6 +22,7 @@
# Suite 330, Boston, MA 02111-1307 USA
use strict;
+use C4::Auth;
use C4::Output;
use CGI;
use HTML::Template;
@@ -43,7 +44,15 @@
manualinvoice($bornum,$itemnum,$desc,$type,$amount);
print $input->redirect("/cgi-bin/koha/moremember.pl?bornum=$bornum");
} else {
- my $template = gettemplate("mancredit.tmpl");
+ my ($template, $loggedinuser, $cookie)
+ = get_template_and_user({template_name => "mancredit.tmpl",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {borrowers => 1},
+ debug => 1,
+ });
$template->param( bornum => $bornum);
- print "Content-Type: text/html\n\n", $template->output;
+ print $input->header(-cookie => $cookie),$template->output;
+
}
View
15 maninvoice.pl
@@ -22,6 +22,7 @@
# Suite 330, Boston, MA 02111-1307 USA
use strict;
+use C4::Auth;
use C4::Output;
use CGI;
use C4::Search;
@@ -43,7 +44,15 @@
manualinvoice($bornum,$itemnum,$desc,$type,$amount);
print $input->redirect("/cgi-bin/koha/moremember.pl?bornum=$bornum");
} else {
- my $template=gettemplate("maninvoice.tmpl");
- $template->param( bornum => $bornum);
- print "Content-Type: text/html\n\n", $template->output;
+ my ($template, $loggedinuser, $cookie)
+ = get_template_and_user({template_name => "maninvoice.tmpl",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {borrowers => 1},
+ debug => 1,
+ });
+ $template->param(bornum => $bornum);
+ print $input->header(-cookie => $cookie),$template->output;
+
}
View
12 member.pl
@@ -24,6 +24,7 @@
# Suite 330, Boston, MA 02111-1307 USA
use strict;
+use C4::Auth;
use C4::Output;
use CGI;
use C4::Search;
@@ -38,7 +39,14 @@
#my $template = HTML::Template->new( filename => $tmpldata{'path'},
# die_on_bad_params => 0,
# loop_context_vars => 1 );
-my $template = gettemplate("members/member.tmpl");
+my ($template, $loggedinuser, $cookie)
+ = get_template_and_user({template_name => "members/member.tmpl",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {borrowers => 1},
+ debug => 1,
+ });
my $member=$input->param('member');
$member=~ s/\,//g;
@@ -70,4 +78,4 @@
member => $member,
resultsloop => \@resultsdata );
-print "Content-Type: text/html\n\n", $template->output;
+print $input->header(-cookie => $cookie),$template->output;
View
12 memberentry.pl
@@ -24,6 +24,7 @@
# Suite 330, Boston, MA 02111-1307 USA
use strict;
+use C4::Auth;
use C4::Context;
use C4::Output;
use CGI;
@@ -33,7 +34,14 @@
my $input = new CGI;
-my $template = gettemplate("members/memberentry.tmpl");
+my ($template, $loggedinuser, $cookie)
+ = get_template_and_user({template_name => "members/memberentry.tmpl",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {borrowers => 1},
+ debug => 1,
+ });
my $member=$input->param('bornum');
if ($member eq ''){
@@ -234,7 +242,7 @@
cardnumber => $cardnumber,
dateofbirth => $data->{'dateofbirth'});
- print "Content-Type: text/html\n\n", $template->output;
+print $input->header(-cookie => $cookie),$template->output;
}
View
14 members-home.pl
@@ -8,11 +8,13 @@
use HTML::Template;
my $query = new CGI;
-my $flagsrequired;
-$flagsrequired->{borrowers}=1;
-my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 0, $flagsrequired);
-
-my $template = gettemplate("members/members-home.tmpl");
-$template->param(loggedinuser => $loggedinuser);
+my ($template, $loggedinuser, $cookie)
+ = get_template_and_user({template_name => "members/members-home.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {borrowers => 1},
+ debug => 1,
+ });
print $query->header(-cookie => $cookie),$template->output;
View
12 moremember.pl
@@ -31,6 +31,7 @@
# Suite 330, Boston, MA 02111-1307 USA
use strict;
+use C4::Auth;
use C4::Context;
use C4::Output;
use CGI;
@@ -46,7 +47,14 @@
my $input = new CGI;
-my $template = gettemplate("members/moremember.tmpl");
+my ($template, $loggedinuser, $cookie)
+ = get_template_and_user({template_name => "members/moremember.tmpl",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {borrowers => 1},
+ debug => 1,
+ });
my $bornum=$input->param('bornum');
@@ -195,4 +203,4 @@
issueloop => \@issuedata,
reserveloop => \@reservedata);
-print "Content-Type: text/html\n\n", $template->output;
+print $input->header(-cookie => $cookie),$template->output;
View
16 readingrec.pl
@@ -23,6 +23,7 @@
# Suite 330, Boston, MA 02111-1307 USA
use strict;
+use C4::Auth;
use C4::Output;
use CGI;
use C4::Search;
@@ -46,11 +47,14 @@
}
my ($count,$issues)=allissues($bornum,$order2,$limit);
-
-#print $input->header;
-#print startpage();
-#print startmenu('member');
-my $template = gettemplate("members/readingrec.tmpl");
+my ($template, $loggedinuser, $cookie)
+= get_template_and_user({template_name => "members/readingrec.tmpl",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {borrowers => 1},
+ debug => 1,
+ });
my @loop_reading;
@@ -68,7 +72,7 @@
bornum => $bornum,
limit => $limit,
loop_reading => \@loop_reading);
-print "Content-Type: text/html\n\n", $template->output;
+print $input->header(-cookie => $cookie),$template->output;
View
13 reports-home.pl
@@ -8,9 +8,12 @@
use HTML::Template;
my $query = new CGI;
-my ($loggedinuser, $cookie, $sessionID) = checkauth($query);
-
-my $template = gettemplate("reports/reports-home.tmpl");
-$template->param(loggedinuser => $loggedinuser);
-
+my ($template, $loggedinuser, $cookie)
+= get_template_and_user({template_name => "reports/reports-home.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {permissions => 1},
+ debug => 1,
+ });
print $query->header(-cookie => $cookie),$template->output;

0 comments on commit 9d54a64

Please sign in to comment.
Something went wrong with that request. Please try again.