Bugzilla – Attachment 143442 Details for
Bug 31378
Add a generic OAuth2/OIDC client implementation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31378: Add domain settings to IdP add page
Bug-31378-Add-domain-settings-to-IdP-add-page.patch (text/plain), 11.71 KB, created by
Martin Renvoize (ashimema)
on 2022-11-08 15:25:57 UTC
(
hide
)
Description:
Bug 31378: Add domain settings to IdP add page
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-11-08 15:25:57 UTC
Size:
11.71 KB
patch
obsolete
>From b6d8419c006466d943040d6cc113ea0c73184aa0 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 8 Nov 2022 11:20:39 -0300 >Subject: [PATCH] Bug 31378: Add domain settings to IdP add page > >This patch introduces a small form for an initial domain configuration >to the 'New identity provider' page, to avoid confusion on testers about >required settings for things to work. > >To test: >1. Apply this patch >2. Verify you are now offered a configuration section for domain > settings. Fields like 'Default category' and 'Default library' are > mandatory. >3. Choosing some values makes them get stored on 'Submit' > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > admin/identity_providers.pl | 56 ++++++++++----- > .../admin/identity_provider_domains.tt | 2 +- > .../en/modules/admin/identity_providers.tt | 71 ++++++++++++++++++- > 3 files changed, 108 insertions(+), 21 deletions(-) > >diff --git a/admin/identity_providers.pl b/admin/identity_providers.pl >index 77d78c90f4..9a5f0cd786 100644 >--- a/admin/identity_providers.pl >+++ b/admin/identity_providers.pl >@@ -26,6 +26,7 @@ use Try::Tiny qw( catch try ); > use C4::Auth qw( get_template_and_user ); > use C4::Output qw( output_html_with_http_headers ); > >+use Koha::Database; > use Koha::Auth::Identity::Providers; > > my $input = CGI->new; >@@ -51,33 +52,52 @@ my @messages; > > if ( !$domain_ops && $op eq 'add' ) { > >+ # IdP configuration params > my $code = $input->param('code'); > my $config = $input->param('config'); > my $description = $input->param('description'); > my $icon_url = $input->param('icon_url'); > my $mapping = $input->param('mapping'); >- my $matchpoint = $input->param('matchpoint'), >+ my $matchpoint = $input->param('matchpoint'); > my $protocol = $input->param('protocol'); >+ # Domain configuration params >+ my $allow_opac = $input->param('allow_opac') // 0; >+ my $allow_staff = $input->param('allow_staff') // 0; >+ my $auto_register = $input->param('auto_register') // 0; >+ my $default_category_id = $input->param('default_category_id'); >+ my $default_library_id = $input->param('default_library_id'); >+ my $domain = $input->param('domain'); >+ my $update_on_auth = $input->param('update_on_$update_on_auth'); > > try { >- my $provider = Koha::Auth::Identity::Provider->new( >- { code => $code, >- config => $config, >- description => $description, >- icon_url => $icon_url, >- mapping => $mapping, >- matchpoint => $matchpoint, >- protocol => $protocol, >+ Koha::Database->new->schema->txn_do( >+ sub { >+ my $provider = Koha::Auth::Identity::Provider->new( >+ { code => $code, >+ config => $config, >+ description => $description, >+ icon_url => $icon_url, >+ mapping => $mapping, >+ matchpoint => $matchpoint, >+ protocol => $protocol, >+ } >+ )->store; >+ >+ Koha::Auth::Identity::Provider::Domain->new( >+ { identity_provider_id => $provider->identity_provider_id, >+ allow_opac => $allow_opac, >+ allow_staff => $allow_staff, >+ auto_register => $auto_register, >+ default_category_id => $default_category_id, >+ default_library_id => $default_library_id, >+ domain => $domain, >+ update_on_auth => $update_on_auth, >+ } >+ )->store; >+ >+ push @messages, { type => 'message', code => 'success_on_insert' }; > } >- )->store; >- >- Koha::Auth::Identity::Provider::Domain->new( >- { >- identity_provider_id => $provider->identity_provider_id, >- } >- )->store; >- >- push @messages, { type => 'message', code => 'success_on_insert' }; >+ ); > } > catch { > if ( blessed $_ and $_->isa('Koha::Exceptions::Object::DuplicateID') ) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/identity_provider_domains.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/identity_provider_domains.tt >index 3ad8593025..c803404771 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/identity_provider_domains.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/identity_provider_domains.tt >@@ -152,7 +152,7 @@ > <option value="1" selected="selected">Allow</option> > <option value="0">Don't allow</option> > </select> >- <span>opac users of this domain to login with this identity provider</span> >+ <span>OPAC users from this domain to login with this identity provider.</span> > </li> > <li> > <label for="allow_opac">Allow staff: </label> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/identity_providers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/identity_providers.tt >index 7505e901f9..460f37ac40 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/identity_providers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/identity_providers.tt >@@ -1,5 +1,7 @@ > [% USE raw %] > [% USE Asset %] >+[% USE Branches %] >+[% USE Categories %] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title> >@@ -87,6 +89,7 @@ > <form action="/cgi-bin/koha/admin/identity_providers.pl" id="add" name="add" class="validated" method="post"> > <input type="hidden" name="op" value="add" /> > <fieldset class="rows"> >+ <legend id="identity_provider_basic">Basic configuration</legend> > <ol> > <li> > <label for="code" class="required">Code: </label> >@@ -116,10 +119,11 @@ > </fieldset> > > <fieldset class="rows"> >+ <legend id="identity_provider_advanced">Advanced configuration</legend> > <ol> > <li> > <label for="config" class="required json">Configuration: </label> >- <textarea name="config" id="config" class="required"></textarea> >+ <textarea name="config" id="config" class="required" cols="75" rows="10"></textarea> > <span class="required">Required</span> > <div class="hint">Provider's main configuration. <button class="more btn btn-ligth" data-target="config"><i class="fa fa-caret-down"></i> More</button></div> > <div class="hint more-config" style="display: none"> >@@ -132,7 +136,7 @@ > </li> > <li> > <label for="mapping" class="required json">Mapping: </label> >- <textarea name="mapping" id="mapping" class="required"></textarea> >+ <textarea name="mapping" id="mapping" class="required" cols="75" rows="10"></textarea> > <span class="required">Required</span> > <div class="hint">Map provider's result to Koha patron's fields. <button class="more btn btn-ligth" data-target="mapping"><i class="fa fa-caret-down"></i> More</button></div> > <div class="hint more-mapping" style="display: none"> >@@ -162,6 +166,69 @@ > </li> > </ol> > </fieldset> >+ >+ <fieldset class="rows"> >+ <legend id="identity_provider_domain">Domain configuration</legend> >+ <ol> >+ <li> >+ <label for="domain" class="required">Domain: </label> >+ <input type="text" name="domain" id="domain" class="required" size="60" /> >+ <span class="required">Required</span> >+ <div class="hint">Use * for any domain. You can add new domains later on the dedicated admin page.</div> >+ </li> >+ <li> >+ <label for="default_library_id">Default library: </label> >+ <select id="default_library_id" name="default_library_id" class="mandatory"> >+ [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1, do_not_select_my_library => 1 ) %] >+ </select> >+ <span class="required">Required</span> >+ <div class="hint">Use this library for the patron on auto register</div> >+ </li> >+ <li> >+ <label for="default_category_id">Default category: </label> >+ [% SET categories = Categories.all() %] >+ <select name="default_category_id" id="default_category_id" class="mandatory"> >+ [% FOREACH category IN categories %] >+ <option value="[% category.categorycode | html %]">[% category.description | html %]</option> >+ [% END %] >+ </select> >+ <span class="required">Required</span> >+ <div class="hint">Use this category for the patron on auto register</div> >+ </li> >+ <li> >+ <label for="allow_opac">Allow OPAC: </label> >+ <select name="allow_opac" id="allow_opac"> >+ <option value="1">Yes</option> >+ <option value="0" selected="selected">No</option> >+ </select> >+ <div class="hint">Allow OPAC access to users from this domain to login with this identity provider.</div> >+ </li> >+ <li> >+ <label for="allow_opac">Allow staff: </label> >+ <select name="allow_staff" id="allow_staff"> >+ <option value="1">Yes</option> >+ <option value="0" selected="selected">No</option> >+ </select> >+ <div class="hint">Allow staff access to users from this domain to login with this identity provider.</div> >+ </li> >+ <li> >+ <label for="auto_register">Auto register: </label> >+ <select name="auto_register" id="auto_register"> >+ <option value="1">Yes</option> >+ <option value="0" selected="selected">No</option> >+ </select> >+ <div class="hint">Allow users to auto register on login.</div> >+ </li> >+ <li> >+ <label for="update_on_auth">Update on login: </label> >+ <select name="update_on_auth" id="update_on_auth"> >+ <option value="1">Yes</option> >+ <option value="0" selected="selected">No</option> >+ </select> >+ <div class="hint">Update user data on login.</div> >+ </ol> >+ </fieldset> >+ > <fieldset class="action"> > <input type="submit" value="Submit" /> > <a class="cancel" href="/cgi-bin/koha/admin/identity_providers.pl">Cancel</a> >-- >2.20.1
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 31378
:
141362
|
141363
|
141364
|
141365
|
141366
|
141367
|
141368
|
141369
|
141370
|
141371
|
141372
|
141373
|
141374
|
141375
|
141376
|
141377
|
141378
|
141514
|
141771
|
141772
|
141773
|
141774
|
141775
|
141776
|
141777
|
141778
|
141779
|
141780
|
141781
|
141782
|
141783
|
141784
|
141785
|
141786
|
141787
|
141788
|
141801
|
141802
|
141803
|
141804
|
141805
|
141806
|
141807
|
141808
|
141809
|
141810
|
141811
|
141812
|
141813
|
141814
|
141815
|
141816
|
141817
|
141818
|
141853
|
143056
|
143087
|
143088
|
143089
|
143090
|
143091
|
143092
|
143093
|
143094
|
143095
|
143096
|
143097
|
143098
|
143099
|
143100
|
143101
|
143102
|
143103
|
143104
|
143105
|
143106
|
143107
|
143186
|
143187
|
143188
|
143189
|
143190
|
143191
|
143192
|
143193
|
143194
|
143195
|
143196
|
143197
|
143198
|
143199
|
143200
|
143202
|
143204
|
143205
|
143206
|
143207
|
143208
|
143215
|
143216
|
143217
|
143218
|
143219
|
143220
|
143221
|
143222
|
143223
|
143224
|
143225
|
143226
|
143227
|
143228
|
143229
|
143230
|
143231
|
143232
|
143233
|
143234
|
143235
|
143236
|
143266
|
143267
|
143268
|
143269
|
143270
|
143271
|
143272
|
143273
|
143274
|
143275
|
143277
|
143278
|
143279
|
143280
|
143281
|
143282
|
143283
|
143284
|
143285
|
143286
|
143287
|
143288
|
143396
|
143397
|
143398
|
143399
|
143400
|
143401
|
143402
|
143403
|
143404
|
143405
|
143406
|
143407
|
143408
|
143409
|
143410
|
143411
|
143412
|
143413
|
143414
|
143415
|
143416
|
143417
|
143418
|
143420
|
143421
|
143422
|
143423
|
143424
|
143425
|
143426
|
143427
|
143428
|
143429
|
143430
|
143431
|
143432
|
143433
|
143434
|
143435
|
143436
|
143437
|
143438
|
143439
|
143440
|
143441
| 143442 |
143443
|
143450
|
144071
|
144175