From 156bd24980bec5f49b39eb6111fddba6f5e922a6 Mon Sep 17 00:00:00 2001 From: tipaul Date: Thu, 7 Apr 2005 10:04:09 +0000 Subject: [PATCH] new CAN_user_XXX template variables --- C4/Auth.pm | 71 +++++++++++++++++++++++++++++++++++++++++++- C4/Auth_with_ldap.pm | 70 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 139 insertions(+), 2 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 18925d0d35..8d0ea60725 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -121,11 +121,80 @@ sub get_template_and_user { $template->param(sessionID => $sessionID); $borrowernumber = getborrowernumber($user); - my ($borr, $flags) = getpatroninformation(undef, $borrowernumber); + my ($borr, $alternativeflags) = getpatroninformation(undef, $borrowernumber); my @bordat; $bordat[0] = $borr; $template->param(USER_INFO => \@bordat, ); + + # We are going to use the $flags returned by checkauth + # to create the template's parameters that will indicate + # which menus the user can access. + if ($flags->{superlibrarian} == 1) + { + $template->param(CAN_user_circulate => 1); + $template->param(CAN_user_catalogue => 1); + $template->param(CAN_user_parameters => 1); + $template->param(CAN_user_borrowers => 1); + $template->param(CAN_user_permission => 1); + $template->param(CAN_user_reserveforothers => 1); + $template->param(CAN_user_borrow => 1); + $template->param(CAN_user_reserveforself => 1); + $template->param(CAN_user_editcatalogue => 1); + $template->param(CAN_user_updatecharge => 1); + $template->param(CAN_user_acquisition => 1); + $template->param(CAN_user_management => 1); + $template->param(CAN_user_tools => 1); } + + if ($flags->{circulate} == 1) { + $template->param(CAN_user_circulate => 1); } + + if ($flags->{catalogue} == 1) { + $template->param(CAN_user_catalogue => 1); } + + + if ($flags->{parameters} == 1) { + $template->param(CAN_user_parameters => 1); + $template->param(CAN_user_management => 1); + $template->param(CAN_user_tools => 1); } + + + if ($flags->{borrowers} == 1) { + $template->param(CAN_user_borrowers => 1); } + + + if ($flags->{permissions} == 1) { + $template->param(CAN_user_permission => 1); } + + if ($flags->{reserveforothers} == 1) { + $template->param(CAN_user_reserveforothers => 1); } + + + if ($flags->{borrow} == 1) { + $template->param(CAN_user_borrow => 1); } + + + if ($flags->{reserveforself} == 1) { + $template->param(CAN_user_reserveforself => 1); } + + + if ($flags->{editcatalogue} == 1) { + $template->param(CAN_user_editcatalogue => 1); } + + + if ($flags->{updatecharges} == 1) { + $template->param(CAN_user_updatecharge => 1); } + + if ($flags->{acquisition} == 1) { + $template->param(CAN_user_acquisition => 1); } + + if ($flags->{management} == 1) { + $template->param(CAN_user_management => 1); + $template->param(CAN_user_tools => 1); } + + if ($flags->{tools} == 1) { + $template->param(CAN_user_tools => 1); } + } $template->param( LibraryName => C4::Context->preference("LibraryName"), diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm index aaa5376039..27aaf53ade 100644 --- a/C4/Auth_with_ldap.pm +++ b/C4/Auth_with_ldap.pm @@ -132,11 +132,79 @@ sub get_template_and_user { $template->param(sessionID => $sessionID); $borrowernumber = getborrowernumber($user); - my ($borr, $flags) = getpatroninformation(undef, $borrowernumber); + my ($borr, $alternativeflags) = getpatroninformation(undef, $borrowernumber); my @bordat; $bordat[0] = $borr; $template->param(USER_INFO => \@bordat, ); + # We are going to use the $flags returned by checkauth + # to create the template's parameters that will indicate + # which menus the user can access. + if ($flags->{superlibrarian} == 1) + { + $template->param(CAN_user_circulate => 1); + $template->param(CAN_user_catalogue => 1); + $template->param(CAN_user_parameters => 1); + $template->param(CAN_user_borrowers => 1); + $template->param(CAN_user_permission => 1); + $template->param(CAN_user_reserveforothers => 1); + $template->param(CAN_user_borrow => 1); + $template->param(CAN_user_reserveforself => 1); + $template->param(CAN_user_editcatalogue => 1); + $template->param(CAN_user_updatecharge => 1); + $template->param(CAN_user_acquisition => 1); + $template->param(CAN_user_management => 1); + $template->param(CAN_user_tools => 1); } + + if ($flags->{circulate} == 1) { + $template->param(CAN_user_circulate => 1); } + + if ($flags->{catalogue} == 1) { + $template->param(CAN_user_catalogue => 1); } + + + if ($flags->{parameters} == 1) { + $template->param(CAN_user_parameters => 1); + $template->param(CAN_user_management => 1); + $template->param(CAN_user_tools => 1); } + + + if ($flags->{borrowers} == 1) { + $template->param(CAN_user_borrowers => 1); } + + + if ($flags->{permissions} == 1) { + $template->param(CAN_user_permission => 1); } + + if ($flags->{reserveforothers} == 1) { + $template->param(CAN_user_reserveforothers => 1); } + + + if ($flags->{borrow} == 1) { + $template->param(CAN_user_borrow => 1); } + + + if ($flags->{reserveforself} == 1) { + $template->param(CAN_user_reserveforself => 1); } + + + if ($flags->{editcatalogue} == 1) { + $template->param(CAN_user_editcatalogue => 1); } + + + if ($flags->{updatecharges} == 1) { + $template->param(CAN_user_updatecharge => 1); } + + if ($flags->{acquisition} == 1) { + $template->param(CAN_user_acquisition => 1); } + + if ($flags->{management} == 1) { + $template->param(CAN_user_management => 1); + $template->param(CAN_user_tools => 1); } + + if ($flags->{tools} == 1) { + $template->param(CAN_user_tools => 1); } + } $template->param( LibraryName => C4::Context->preference("LibraryName"), -- 2.39.5