Lines 23-28
use C4::Debug;
Link Here
|
23 |
use C4::Context; |
23 |
use C4::Context; |
24 |
use Koha::AuthUtils qw(get_script_name); |
24 |
use Koha::AuthUtils qw(get_script_name); |
25 |
use Koha::Database; |
25 |
use Koha::Database; |
|
|
26 |
use C4::Members qw( AddMember_Auto ); |
27 |
use C4::Members::Messaging; |
26 |
use Carp; |
28 |
use Carp; |
27 |
use CGI; |
29 |
use CGI; |
28 |
|
30 |
|
Lines 102-112
sub checkpw_shib {
Link Here
|
102 |
return ( 1, $borrower->get_column('cardnumber'), $borrower->get_column('userid') ); |
104 |
return ( 1, $borrower->get_column('cardnumber'), $borrower->get_column('userid') ); |
103 |
} |
105 |
} |
104 |
|
106 |
|
105 |
# If we reach this point, the user is not a valid koha user |
107 |
if ( $shib->{'autocreate'} ) { |
106 |
$debug |
108 |
return _autocreate( $dbh, $shib, $userid ); |
107 |
and warn |
109 |
} else { |
108 |
"User with $config->{matchpoint} of $match is not a valid Koha user"; |
110 |
# If we reach this point, the user is not a valid koha user |
109 |
return 0; |
111 |
$debug and warn "User $userid is not a valid Koha user"; |
|
|
112 |
return 0; |
113 |
} |
114 |
} |
115 |
|
116 |
sub _autocreate { |
117 |
my ( $dbh, $shib, $userid ) = @_; |
118 |
|
119 |
my %borrower = ( userid => $userid ); |
120 |
|
121 |
while ( my ( $key, $entry ) = each %{$shib->{'mapping'}} ) { |
122 |
$borrower{$key} = ( $entry->{'is'} && $ENV{ $entry->{'is'} } ) || $entry->{'content'} || ''; |
123 |
} |
124 |
|
125 |
%borrower = AddMember_Auto( %borrower ); |
126 |
C4::Members::Messaging::SetMessagingPreferencesFromDefaults( { borrowernumber => $borrower{'borrowernumber'}, categorycode => $borrower{'categorycode'} } ); |
127 |
|
128 |
return ( 1, $borrower{'cardnumber'}, $borrower{'userid'} ); |
110 |
} |
129 |
} |
111 |
|
130 |
|
112 |
sub _get_uri { |
131 |
sub _get_uri { |