Lines 74-80
BEGIN {
Link Here
|
74 |
@EXPORT_OK = qw( |
74 |
@EXPORT_OK = qw( |
75 |
checkauth check_api_auth get_session check_cookie_auth checkpw checkpw_internal checkpw_hash |
75 |
checkauth check_api_auth get_session check_cookie_auth checkpw checkpw_internal checkpw_hash |
76 |
get_all_subpermissions get_user_subpermissions track_login_daily in_iprange |
76 |
get_all_subpermissions get_user_subpermissions track_login_daily in_iprange |
77 |
get_template_and_user haspermission |
77 |
get_template_and_user haspermission create_basic_session |
78 |
); |
78 |
); |
79 |
|
79 |
|
80 |
$ldap = C4::Context->config('useldapserver') || 0; |
80 |
$ldap = C4::Context->config('useldapserver') || 0; |
Lines 1561-1567
sub check_api_auth {
Link Here
|
1561 |
# new login |
1561 |
# new login |
1562 |
my $userid = $query->param('userid'); |
1562 |
my $userid = $query->param('userid'); |
1563 |
my $password = $query->param('password'); |
1563 |
my $password = $query->param('password'); |
1564 |
my $auth_client_login = $query->param('auth_client_login'); |
|
|
1565 |
my ( $return, $cardnumber, $cas_ticket ); |
1564 |
my ( $return, $cardnumber, $cas_ticket ); |
1566 |
|
1565 |
|
1567 |
# Proxy CAS auth |
1566 |
# Proxy CAS auth |
Lines 1571-1579
sub check_api_auth {
Link Here
|
1571 |
# In case of a CAS authentication, we use the ticket instead of the password |
1570 |
# In case of a CAS authentication, we use the ticket instead of the password |
1572 |
my $PT = $query->param('PT'); |
1571 |
my $PT = $query->param('PT'); |
1573 |
( $return, $cardnumber, $userid, $cas_ticket ) = check_api_auth_cas( $PT, $query ); # EXTERNAL AUTH |
1572 |
( $return, $cardnumber, $userid, $cas_ticket ) = check_api_auth_cas( $PT, $query ); # EXTERNAL AUTH |
1574 |
} elsif ( $auth_client_login && ( $userid || $query->param('cardnumber') ) ) { |
|
|
1575 |
$cardnumber = $query->param('cardnumber'); |
1576 |
$return = 1; |
1577 |
} else { |
1573 |
} else { |
1578 |
|
1574 |
|
1579 |
# User / password auth |
1575 |
# User / password auth |
Lines 1871-1876
sub get_session {
Link Here
|
1871 |
return $session; |
1867 |
return $session; |
1872 |
} |
1868 |
} |
1873 |
|
1869 |
|
|
|
1870 |
=head2 create_basic_session |
1871 |
|
1872 |
my $session = create_basic_session({ patron => $patron, interface => $interface }); |
1873 |
|
1874 |
Creates a session and adds all basic parameters for a session to work |
1875 |
|
1876 |
=cut |
1877 |
|
1878 |
sub create_basic_session { |
1879 |
my $params = shift; |
1880 |
my $patron = $params->{patron}; |
1881 |
my $interface = $params->{interface}; |
1882 |
|
1883 |
my $session = get_session(""); |
1884 |
|
1885 |
$session->param( 'number', $patron->borrowernumber ); |
1886 |
$session->param( 'id', $patron->userid ); |
1887 |
$session->param( 'cardnumber', $patron->cardnumber ); |
1888 |
$session->param( 'firstname', $patron->firstname ); |
1889 |
$session->param( 'surname', $patron->surname ); |
1890 |
$session->param( 'branch', $patron->branchcode ); |
1891 |
$session->param( 'branchname', $patron->library->branchname ); |
1892 |
$session->param( 'flags', $patron->flags ); |
1893 |
$session->param( 'emailaddress', $patron->email ); |
1894 |
$session->param( 'ip', $session->remote_addr() ); |
1895 |
$session->param( 'lasttime', time() ); |
1896 |
$session->param( 'interface', $interface); |
1897 |
|
1898 |
return $session; |
1899 |
} |
1900 |
|
1874 |
|
1901 |
|
1875 |
# FIXME no_set_userenv may be replaced with force_branchcode_for_userenv |
1902 |
# FIXME no_set_userenv may be replaced with force_branchcode_for_userenv |
1876 |
# (or something similar) |
1903 |
# (or something similar) |