Lines 22-27
use warnings;
Link Here
|
22 |
|
22 |
|
23 |
use C4::Debug; |
23 |
use C4::Debug; |
24 |
use C4::Context; |
24 |
use C4::Context; |
|
|
25 |
use C4::Members qw( AddMember_Auto ); |
26 |
use C4::Members::Messaging; |
25 |
use Carp; |
27 |
use Carp; |
26 |
use CGI; |
28 |
use CGI; |
27 |
|
29 |
|
Lines 95-103
sub checkpw_shib {
Link Here
|
95 |
return ( 1, $retnumber, $userid ); |
97 |
return ( 1, $retnumber, $userid ); |
96 |
} |
98 |
} |
97 |
|
99 |
|
98 |
# If we reach this point, the user is not a valid koha user |
100 |
if ( $shib->{'autocreate'} ) { |
99 |
$debug and warn "User $userid is not a valid Koha user"; |
101 |
return _autocreate( $dbh, $shib, $userid ); |
100 |
return 0; |
102 |
} else { |
|
|
103 |
# If we reach this point, the user is not a valid koha user |
104 |
$debug and warn "User $userid is not a valid Koha user"; |
105 |
return 0; |
106 |
} |
107 |
} |
108 |
|
109 |
sub _autocreate { |
110 |
my ( $dbh, $shib, $userid ) = @_; |
111 |
|
112 |
my %borrower = ( userid => $userid ); |
113 |
|
114 |
while ( my ( $key, $entry ) = each %{$shib->{'mapping'}} ) { |
115 |
$borrower{$key} = ( $entry->{'is'} && $ENV{ $entry->{'is'} } ) || $entry->{'content'} || ''; |
116 |
} |
117 |
|
118 |
%borrower = AddMember_Auto( %borrower ); |
119 |
C4::Members::Messaging::SetMessagingPreferencesFromDefaults( { borrowernumber => $borrower{'borrowernumber'}, categorycode => $borrower{'categorycode'} } ); |
120 |
|
121 |
return ( 1, $borrower{'cardnumber'}, $borrower{'userid'} ); |
101 |
} |
122 |
} |
102 |
|
123 |
|
103 |
1; |
124 |
1; |