From 3c7ae06bcc4310ad2ca135d3e4f445a9f2b0fefd Mon Sep 17 00:00:00 2001 From: Slava Shishkin Date: Wed, 25 Oct 2023 19:55:02 +0300 Subject: [PATCH] Bug 35617: Extending the matchpoint in "identity_providers" by phone number Update identity_providers to include 'phone' as a matchpoint, also as option in the dropdown menu. Further when authentication phase 'phone' will be used as the matchpoint like email, userid, or cardnumber. --- .../definitions/identity_provider.yaml | 1 + .../atomicupdate/extend_identity_providers.pl | 23 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 2 +- .../en/modules/admin/identity_providers.tt | 6 +++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/extend_identity_providers.pl diff --git a/api/v1/swagger/definitions/identity_provider.yaml b/api/v1/swagger/definitions/identity_provider.yaml index c9fc649d42..4a79ebfb97 100644 --- a/api/v1/swagger/definitions/identity_provider.yaml +++ b/api/v1/swagger/definitions/identity_provider.yaml @@ -29,6 +29,7 @@ properties: type: string enum: - email + - phone - userid - cardnumber config: diff --git a/installer/data/mysql/atomicupdate/extend_identity_providers.pl b/installer/data/mysql/atomicupdate/extend_identity_providers.pl new file mode 100644 index 0000000000..222529ff8a --- /dev/null +++ b/installer/data/mysql/atomicupdate/extend_identity_providers.pl @@ -0,0 +1,23 @@ +use Modern::Perl; + +return { + bug_number => "35617", + description => "Extend matchpoint in identity_providers", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + # Do you stuffs here + # now is `matchpoint` enum('email','phone','userid','cardnumber') NOT NULL COMMENT + $dbh->do(q{ + ALTER TABLE `identity_providers` + MODIFY COLUMN `matchpoint` enum('email','phone','userid','cardnumber') NOT NULL COMMENT 'The field of the patron that will be used to match the user from the identity provider'; + + }); + + # Print useful stuff here + # tables + say $out "Extend 'matchpoint' field in 'identity_providers'"; + + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 0b59ad8d85..c7f276465c 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3546,7 +3546,7 @@ CREATE TABLE `identity_providers` ( `protocol` enum('OAuth','OIDC','LDAP','CAS') NOT NULL COMMENT 'Protocol provider speaks', `config` longtext NOT NULL COMMENT 'Configuration of the provider in JSON format', `mapping` longtext NOT NULL COMMENT 'Configuration to map provider data to Koha user', - `matchpoint` enum('email','userid','cardnumber') NOT NULL COMMENT 'The patron attribute to be used as matchpoint', + `matchpoint` enum('email','phone','userid','cardnumber') NOT NULL COMMENT 'The patron attribute to be used as matchpoint', `icon_url` varchar(255) DEFAULT NULL COMMENT 'Provider icon URL', PRIMARY KEY (`identity_provider_id`), UNIQUE KEY `code` (`code`), 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 95c56756ce..d0dcba6299 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 @@ -149,6 +149,7 @@ @@ -317,6 +318,11 @@ [%- ELSE -%] [%- END -%] + [%- IF identity_provider.matchpoint == 'phone' -%] + + [%- ELSE -%] + + [%- END -%] [%- IF identity_provider.matchpoint == 'userid' -%] [%- ELSE -%] -- 2.43.0