Bugzilla – Attachment 31054 Details for
Bug 12026
Shibboleth auto-provisioning - Create
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED OFF] BUG12026: Adds auto-provisioning to shibboleth
SIGNED-OFF-BUG12026-Adds-auto-provisioning-to-shib.patch (text/plain), 3.06 KB, created by
Martin Renvoize (ashimema)
on 2014-08-21 15:06:14 UTC
(
hide
)
Description:
[SIGNED OFF] BUG12026: Adds auto-provisioning to shibboleth
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2014-08-21 15:06:14 UTC
Size:
3.06 KB
patch
obsolete
>From 2666aa4669d5271256a8f06490a0ae0ddae8aedb Mon Sep 17 00:00:00 2001 >From: Jesse Weaver <pianohacker@gmail.com> >Date: Wed, 2 Apr 2014 15:53:03 +0000 >Subject: [PATCH] [SIGNED OFF] BUG12026: 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: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Auth_with_shibboleth.pm | 27 ++++++++++++++++++++++++--- > C4/Members.pm | 15 +++++++++++++-- > 2 files changed, 37 insertions(+), 5 deletions(-) > >diff --git a/C4/Auth_with_shibboleth.pm b/C4/Auth_with_shibboleth.pm >index 863ea82..8f71726 100644 >--- a/C4/Auth_with_shibboleth.pm >+++ b/C4/Auth_with_shibboleth.pm >@@ -22,6 +22,8 @@ use warnings; > > use C4::Debug; > use C4::Context; >+use C4::Members qw( AddMember_Auto ); >+use C4::Members::Messaging; > use Carp; > use CGI; > >@@ -104,9 +106,13 @@ sub checkpw_shib { > return ( 1, $retnumber, $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 ( $config->{'autocreate'} ) { >+ return _autocreate( $dbh, $config, $match ); >+ } else { >+ # 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; >+ } > } > > sub _get_uri { >@@ -146,6 +152,21 @@ sub _get_shib_config { > } > } > >+sub _autocreate { >+ my ( $dbh, $config, $match ) = @_; >+ >+ my %borrower = ( $config->{matchpoint} => $match ); >+ >+ while ( my ( $key, $entry ) = each %{$config->{'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'} ); >+} >+ > 1; > __END__ > >diff --git a/C4/Members.pm b/C4/Members.pm >index 326344d..6eff644 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -121,6 +121,7 @@ BEGIN { > #Insert data > push @EXPORT, qw( > &AddMember >+ &AddMember_Auto > &AddMember_Opac > &MoveMemberToDeleted > &ExtendMemberSubscriptionTo >@@ -2435,6 +2436,16 @@ sub GetBorrowersWithEmail { > return @result; > } > >+sub AddMember_Auto { >+ my ( %borrower ) = @_; >+ >+ $borrower{'cardnumber'} ||= fixup_cardnumber(); >+ >+ $borrower{'borrowernumber'} = AddMember(%borrower); >+ >+ return ( %borrower ); >+} >+ > sub AddMember_Opac { > my ( %borrower ) = @_; > >@@ -2447,9 +2458,9 @@ sub AddMember_Opac { > > $borrower{'cardnumber'} = fixup_cardnumber(); > >- my $borrowernumber = AddMember(%borrower); >+ %borrower = AddMember_Auto(%borrower); > >- return ( $borrowernumber, $password ); >+ return ( $borrower{'borrowernumber'}, $borrower{'password'} ); > } > > =head2 AddEnrolmentFeeIfNeeded >-- >1.7.10.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