Bugzilla – Attachment 61444 Details for
Bug 12026
Shibboleth auto-provisioning - Create
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12026: Adds auto-provisioning to shibboleth
Bug-12026-Adds-auto-provisioning-to-shibboleth.patch (text/plain), 3.09 KB, created by
Martin Renvoize (ashimema)
on 2017-03-22 13:58:23 UTC
(
hide
)
Description:
Bug 12026: Adds auto-provisioning to shibboleth
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2017-03-22 13:58:23 UTC
Size:
3.09 KB
patch
obsolete
>From 14d29e4912fb7fad4e23c66fcb6917df8f130a61 Mon Sep 17 00:00:00 2001 >From: Jesse Weaver <pianohacker@gmail.com> >Date: Wed, 2 Apr 2014 15:53:03 +0000 >Subject: [PATCH] Bug 12026: Adds auto-provisioning to shibboleth > >- Adds the option to map shibboleth attributes to koha user columns > and allows mapping to auto create non-existant users > >Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Auth_with_shibboleth.pm | 29 ++++++++++++++++++++++++----- > C4/Members.pm | 19 +++++++++++++++++-- > 2 files changed, 41 insertions(+), 7 deletions(-) > >diff --git a/C4/Auth_with_shibboleth.pm b/C4/Auth_with_shibboleth.pm >index cde0ede..ce2942e 100644 >--- a/C4/Auth_with_shibboleth.pm >+++ b/C4/Auth_with_shibboleth.pm >@@ -23,6 +23,8 @@ use C4::Debug; > use C4::Context; > use Koha::AuthUtils qw(get_script_name); > use Koha::Database; >+use C4::Members qw( AddMember_Auto ); >+use C4::Members::Messaging; > use Carp; > use CGI; > >@@ -102,11 +104,28 @@ sub checkpw_shib { > return ( 1, $borrower->get_column('cardnumber'), $borrower->get_column('userid') ); > } > >- # If we reach this point, the user is not a valid koha user >- $debug >- and warn >- "User with $config->{matchpoint} of $match is not a valid Koha user"; >- return 0; >+ if ( $shib->{'autocreate'} ) { >+ return _autocreate( $dbh, $shib, $userid ); >+ } else { >+ # If we reach this point, the user is not a valid koha user >+ $debug and warn "User $userid is not a valid Koha user"; >+ return 0; >+ } >+} >+ >+sub _autocreate { >+ my ( $dbh, $shib, $userid ) = @_; >+ >+ my %borrower = ( userid => $userid ); >+ >+ while ( my ( $key, $entry ) = each %{$shib->{'mapping'}} ) { >+ $borrower{$key} = ( $entry->{'is'} && $ENV{ $entry->{'is'} } ) || $entry->{'content'} || ''; >+ } >+ >+ %borrower = AddMember_Auto( %borrower ); >+ C4::Members::Messaging::SetMessagingPreferencesFromDefaults( { borrowernumber => $borrower{'borrowernumber'}, categorycode => $borrower{'categorycode'} } ); >+ >+ return ( 1, $borrower{'cardnumber'}, $borrower{'userid'} ); > } > > sub _get_uri { >diff --git a/C4/Members.pm b/C4/Members.pm >index 8e73872..abdffb4 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -88,6 +88,7 @@ BEGIN { > #Insert data > push @EXPORT, qw( > &AddMember >+ &AddMember_Auto > &AddMember_Opac > ); > >@@ -1261,6 +1262,20 @@ sub GetBorrowersWithEmail { > return @result; > } > >+=head2 AddMember_Auto >+ >+=cut >+ >+sub AddMember_Auto { >+ my ( %borrower ) = @_; >+ >+ $borrower{'cardnumber'} ||= fixup_cardnumber(); >+ >+ $borrower{'borrowernumber'} = AddMember(%borrower); >+ >+ return ( %borrower ); >+} >+ > =head2 AddMember_Opac > > =cut >@@ -1278,9 +1293,9 @@ sub AddMember_Opac { > > $borrower{'cardnumber'} = fixup_cardnumber( $borrower{'cardnumber'} ); > >- my $borrowernumber = AddMember(%borrower); >+ %borrower = AddMember_Auto(%borrower); > >- return ( $borrowernumber, $borrower{'password'} ); >+ return ( $borrower{'borrowernumber'}, $borrower{'password'} ); > } > > =head2 DeleteExpiredOpacRegistrations >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12026
:
26769
|
26788
|
28408
|
30351
|
30352
|
30376
|
31054
|
31055
|
35551
|
35552
|
56241
|
56242
|
56243
|
57486
|
57563
|
57564
|
57565
|
57566
|
61268
|
61269
|
61270
|
61271
|
61363
|
61364
|
61365
|
61366
|
61367
|
61435
|
61436
|
61437
|
61438
|
61444
|
61445
|
61446
|
61447
|
61448
|
61449
|
61521
|
61522
|
61523
|
61524
|
61525
|
61526
|
61527
|
61596
|
61598
|
61599
|
61675
|
61676
|
61677
|
61678
|
61679
|
61680
|
61683
|
61684
|
62521
|
62522