From 9d6cea1b269354ef3595f827f674905c98e49b5d 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 | 22 ++++-- .../admin/identity_provider_domains.tt | 74 +++++++++++-------- 2 files changed, 57 insertions(+), 39 deletions(-) diff --git a/admin/identity_providers.pl b/admin/identity_providers.pl index 8d62fdf971..7f2d6a775d 100755 --- a/admin/identity_providers.pl +++ b/admin/identity_providers.pl @@ -63,9 +63,10 @@ if ( !$domain_ops && $op eq 'cud-add' ) { 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 $allow_opac = $input->param('allow_opac') // 0; + my $allow_staff = $input->param('allow_staff') // 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'); @@ -91,7 +92,8 @@ if ( !$domain_ops && $op eq 'cud-add' ) { 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, @@ -120,7 +122,8 @@ if ( !$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'); @@ -133,7 +136,8 @@ if ( !$domain_ops && $op eq 'cud-add' ) { allow_opac => $allow_opac, allow_staff => $allow_staff, identity_provider_id => $identity_provider_id, - 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, @@ -245,7 +249,8 @@ if ( !$domain_ops && $op eq 'cud-add' ) { my $identity_provider_id = $input->param('identity_provider_id'); my $domain = $input->param('domain'); - my $auto_register = $input->param('auto_register'); + my $auto_register_opac = $input->param('auto_register_opac') // 0; + my $auto_register_staff = $input->param('auto_register_staff') // 0; my $update_on_auth = $input->param('update_on_auth'); my $default_library_id = $input->param('default_library_id') || undef; my $default_category_id = $input->param('default_category_id') || undef; @@ -258,7 +263,8 @@ if ( !$domain_ops && $op eq 'cud-add' ) { { identity_provider_id => $identity_provider_id, domain => $domain, - auto_register => $auto_register, + auto_register_opac => $auto_register_opac, + auto_register_staff => $auto_register_staff, update_on_auth => $update_on_auth, default_library_id => $default_library_id, default_category_id => $default_category_id, 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 46f79beba5..8b63db7048 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 @@ -116,12 +116,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)
  • @@ -205,9 +213,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
  • @@ -289,38 +310,18 @@ Domain Update on login - Auto register + Auto register (OPAC) + Auto register (Staff) Default library Default category Allow OPAC Allow staff - Actions + Actions [% END %] - - - [% END %] [% MACRO jsinclude BLOCK %] @@ -390,7 +391,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.51.0