Lines 22-27
use Modern::Perl;
Link Here
|
22 |
use C4::Debug; |
22 |
use C4::Debug; |
23 |
use C4::Context; |
23 |
use C4::Context; |
24 |
use Koha::Database; |
24 |
use Koha::Database; |
|
|
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 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 ( $config->{'autocreate'} ) { |
106 |
$debug |
108 |
return _autocreate( $dbh, $config, $match ); |
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 with $config->{matchpoint} of $match is not a valid Koha user"; |
|
|
112 |
return 0; |
113 |
} |
110 |
} |
114 |
} |
111 |
|
115 |
|
112 |
sub _get_uri { |
116 |
sub _get_uri { |
Lines 146-151
sub _get_shib_config {
Link Here
|
146 |
} |
150 |
} |
147 |
} |
151 |
} |
148 |
|
152 |
|
|
|
153 |
sub _autocreate { |
154 |
my ( $dbh, $config, $match ) = @_; |
155 |
|
156 |
my %borrower = ( $config->{matchpoint} => $match ); |
157 |
|
158 |
while ( my ( $key, $entry ) = each %{$config->{'mapping'}} ) { |
159 |
$borrower{$key} = ( $entry->{'is'} && $ENV{ $entry->{'is'} } ) || $entry->{'content'} || ''; |
160 |
} |
161 |
|
162 |
%borrower = AddMember_Auto( %borrower ); |
163 |
C4::Members::Messaging::SetMessagingPreferencesFromDefaults( { borrowernumber => $borrower{'borrowernumber'}, categorycode => $borrower{'categorycode'} } ); |
164 |
|
165 |
return ( 1, $borrower{'cardnumber'}, $borrower{'userid'} ); |
166 |
} |
167 |
|
149 |
1; |
168 |
1; |
150 |
__END__ |
169 |
__END__ |
151 |
|
170 |
|