From 1436dea179011582f7d08ea9752214551e90509d Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 22 Aug 2024 15:50:16 -0300 Subject: [PATCH] Bug 37711: Domains CRUD update This patch adapts the `Identity provider domains` CRUD page to handle the new configuration options. To test: 1. Have an IdP with some domains set. Make sure there's at least one domain with auto-register enabled and one with it disabled. 2. Apply this patches 3. Run: $ ktd --shell k$ updatedatabase => SUCCESS: Updates successfully 4. Run: k$ yarn build 5. Refresh the IdP domains page => SUCCESS: The domains table shows both OPAC and staff auto-register options. => SUCCESS: The staff auto-register is disabled for both domains => SUCCESS: The OPAC auto-register matches what was set for each domain regarding auto-register (remember that before this patchset, auto-register only works for the OPAC). 6. Play with editing/adding/removing domain configurations => SUCCESS: Things work as expected, values are persisted on the DB correctly. 7. Sign off :-D Signed-off-by: Martin Renvoize --- admin/identity_providers.pl | 29 ++++++----- .../admin/identity_provider_domains.tt | 51 +++++++++++++++---- 2 files changed, 59 insertions(+), 21 deletions(-) diff --git a/admin/identity_providers.pl b/admin/identity_providers.pl index 74416f6aa73..1b3993600a9 100755 --- a/admin/identity_providers.pl +++ b/admin/identity_providers.pl @@ -63,7 +63,8 @@ if ( !$domain_ops && $op eq 'cud-add' ) { # 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 $auto_register_opac = $input->param('auto_register_opac') // 0; + my $auto_register_staff = $input->param('auto_register_staff') // 0; my $default_category_id = $input->param('default_category_id'); my $default_library_id = $input->param('default_library_id'); my $domain = $input->param('domain'); @@ -84,10 +85,12 @@ if ( !$domain_ops && $op eq 'cud-add' ) { )->store; Koha::Auth::Identity::Provider::Domain->new( - { identity_provider_id => $provider->identity_provider_id, + { + identity_provider_id => $provider->identity_provider_id, allow_opac => $allow_opac, allow_staff => $allow_staff, - auto_register => $auto_register, + auto_register_opac => $auto_register_opac, + auto_register_staff => $auto_register_staff, default_category_id => $default_category_id, default_library_id => $default_library_id, domain => $domain, @@ -118,7 +121,8 @@ elsif ( $domain_ops && $op eq 'cud-add' ) { my $allow_opac = $input->param('allow_opac'); my $allow_staff = $input->param('allow_staff'); my $identity_provider_id = $input->param('identity_provider_id'); - my $auto_register = $input->param('auto_register'); + my $auto_register_opac = $input->param('auto_register_opac'); + my $auto_register_staff = $input->param('auto_register_staff'); my $default_category_id = $input->param('default_category_id') || undef; my $default_library_id = $input->param('default_library_id') || undef; my $domain = $input->param('domain'); @@ -128,14 +132,15 @@ elsif ( $domain_ops && $op eq 'cud-add' ) { Koha::Auth::Identity::Provider::Domain->new( { - allow_opac => $allow_opac, - allow_staff => $allow_staff, - identity_provider_id => $identity_provider_id, - auto_register => $auto_register, - default_category_id => $default_category_id, - default_library_id => $default_library_id, - domain => $domain, - update_on_auth => $update_on_auth, + allow_opac => $allow_opac, + allow_staff => $allow_staff, + identity_provider_id => $identity_provider_id, + auto_register_opac => $auto_register_opac, + auto_register_staff => $auto_register_staff, + default_category_id => $default_category_id, + default_library_id => $default_library_id, + domain => $domain, + update_on_auth => $update_on_auth, } )->store; 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 7f2cf0a5c00..2f0cca81c0e 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 @@ -113,12 +113,20 @@ user data on login
  • - - - users to auto register on login + users to auto register on login (OPAC) +
  • +
  • + + + users to auto register on login (Staff interface)
  • @@ -201,9 +209,22 @@ user data on login
  • - - + [% IF identity_provider_domain.auto_register_opac == "1" %] + + + [% ELSE %] + + + [% END %] + + users to auto register on OPAC login +
  • +
  • + + - users to auto register on login + users to auto register on staff interface login
  • @@ -285,7 +306,8 @@ Domain Update on login - Auto register + Auto register (OPAC) + Auto register (Staff) Default library Default category Allow OPAC @@ -393,7 +415,18 @@ }, { "data": function( row, type, val, meta ) { - if (row.auto_register) { + if (row.auto_register_opac) { + return _("Yes"); + } else { + return _("No"); + } + }, + "searchable": true, + "orderable": true + }, + { + "data": function( row, type, val, meta ) { + if (row.auto_register_staff) { return _("Yes"); } else { return _("No"); -- 2.47.0