|
Lines 55-61
BEGIN {
Link Here
|
| 55 |
@ISA = qw(Exporter); |
55 |
@ISA = qw(Exporter); |
| 56 |
@EXPORT = qw(&checkauth &get_template_and_user &haspermission &get_user_subpermissions); |
56 |
@EXPORT = qw(&checkauth &get_template_and_user &haspermission &get_user_subpermissions); |
| 57 |
@EXPORT_OK = qw(&check_api_auth &get_session &check_cookie_auth &checkpw &checkpw_internal &checkpw_hash |
57 |
@EXPORT_OK = qw(&check_api_auth &get_session &check_cookie_auth &checkpw &checkpw_internal &checkpw_hash |
| 58 |
&get_all_subpermissions &get_user_subpermissions |
58 |
&get_all_subpermissions &get_user_subpermissions track_login_for_session |
| 59 |
); |
59 |
); |
| 60 |
%EXPORT_TAGS = ( EditPermissions => [qw(get_all_subpermissions get_user_subpermissions)] ); |
60 |
%EXPORT_TAGS = ( EditPermissions => [qw(get_all_subpermissions get_user_subpermissions)] ); |
| 61 |
$ldap = C4::Context->config('useldapserver') || 0; |
61 |
$ldap = C4::Context->config('useldapserver') || 0; |
|
Lines 802-807
sub checkauth {
Link Here
|
| 802 |
my $casparam = $query->param('cas'); |
802 |
my $casparam = $query->param('cas'); |
| 803 |
my $q_userid = $query->param('userid') // ''; |
803 |
my $q_userid = $query->param('userid') // ''; |
| 804 |
|
804 |
|
|
|
805 |
my $session; |
| 806 |
|
| 805 |
# Basic authentication is incompatible with the use of Shibboleth, |
807 |
# Basic authentication is incompatible with the use of Shibboleth, |
| 806 |
# as Shibboleth may return REMOTE_USER as a Shibboleth attribute, |
808 |
# as Shibboleth may return REMOTE_USER as a Shibboleth attribute, |
| 807 |
# and it may not be the attribute we want to use to match the koha login. |
809 |
# and it may not be the attribute we want to use to match the koha login. |
|
Lines 827-833
sub checkauth {
Link Here
|
| 827 |
} |
829 |
} |
| 828 |
elsif ( $sessionID = $query->cookie("CGISESSID") ) |
830 |
elsif ( $sessionID = $query->cookie("CGISESSID") ) |
| 829 |
{ # assignment, not comparison |
831 |
{ # assignment, not comparison |
| 830 |
my $session = get_session($sessionID); |
832 |
$session = get_session($sessionID); |
| 831 |
C4::Context->_new_userenv($sessionID); |
833 |
C4::Context->_new_userenv($sessionID); |
| 832 |
my ( $ip, $lasttime, $sessiontype ); |
834 |
my ( $ip, $lasttime, $sessiontype ); |
| 833 |
my $s_userid = ''; |
835 |
my $s_userid = ''; |
|
Lines 1199-1209
sub checkauth {
Link Here
|
| 1199 |
); |
1201 |
); |
| 1200 |
} |
1202 |
} |
| 1201 |
|
1203 |
|
| 1202 |
if ( $userid ) { |
1204 |
track_login_for_session( $userid, $session ); |
| 1203 |
# track_login also depends on pref TrackLastPatronActivity |
|
|
| 1204 |
my $patron = Koha::Patrons->find({ userid => $userid }); |
| 1205 |
$patron->track_login if $patron; |
| 1206 |
} |
| 1207 |
|
1205 |
|
| 1208 |
return ( $userid, $cookie, $sessionID, $flags ); |
1206 |
return ( $userid, $cookie, $sessionID, $flags ); |
| 1209 |
} |
1207 |
} |
|
Lines 2078-2083
sub getborrowernumber {
Link Here
|
| 2078 |
return 0; |
2076 |
return 0; |
| 2079 |
} |
2077 |
} |
| 2080 |
|
2078 |
|
|
|
2079 |
=head2 track_login_for_session |
| 2080 |
|
| 2081 |
track_login_for_session( $userid, $session ); |
| 2082 |
|
| 2083 |
C<$userid> the userid of the member |
| 2084 |
C<$session> the CGI::Session object used to store the session's state. |
| 2085 |
|
| 2086 |
Wraps the call to $patron->track_login, the method used to update borrowers.lastseen. |
| 2087 |
|
| 2088 |
=cut |
| 2089 |
|
| 2090 |
sub track_login_for_session { |
| 2091 |
my ( $userid, $session ) = @_; |
| 2092 |
|
| 2093 |
if ( $userid && $session && !$session->param('tracked_for_session') ) { |
| 2094 |
$session->param( 'tracked_for_session', 1 ); |
| 2095 |
$session->flush(); |
| 2096 |
|
| 2097 |
# track_login also depends on pref TrackLastPatronActivity |
| 2098 |
my $patron = Koha::Patrons->find( { userid => $userid } ); |
| 2099 |
$patron->track_login if $patron; |
| 2100 |
} |
| 2101 |
} |
| 2102 |
|
| 2081 |
END { } # module clean-up code here (global destructor) |
2103 |
END { } # module clean-up code here (global destructor) |
| 2082 |
1; |
2104 |
1; |
| 2083 |
__END__ |
2105 |
__END__ |