Bugzilla – Attachment 193682 Details for
Bug 39224
Migrate SAML/Shibboleth configuration into Identity Providers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39224: DBIx::Class schema update
f365c17.patch (text/plain), 12.81 KB, created by
Martin Renvoize (ashimema)
on 2026-02-24 07:33:44 UTC
(
hide
)
Description:
Bug 39224: DBIx::Class schema update
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-02-24 07:33:44 UTC
Size:
12.81 KB
patch
obsolete
>From f365c170f82cfc7bb9aa2bb063e1d3b9cd6d9e16 Mon Sep 17 00:00:00 2001 >From: Jacob O'Mara <jacob.omara@openfifth.co.uk> >Date: Sun, 22 Feb 2026 20:17:33 +0000 >Subject: [PATCH] Bug 39224: DBIx::Class schema update > >Auto-generated DBIx::Class schema updates from database changes: > >- New Result classes: Hostname, IdentityProviderHostname, > IdentityProviderMapping >- Updated Result classes: IdentityProvider (new columns and > relationships), IdentityProviderDomain (new relationships) > >Sponsored-by: ByWater Solutions >--- > Koha/Schema/Result/Hostname.pm | 98 +++++++++++ > Koha/Schema/Result/IdentityProvider.pm | 63 ++++--- > Koha/Schema/Result/IdentityProviderDomain.pm | 14 +- > .../Schema/Result/IdentityProviderHostname.pm | 162 ++++++++++++++++++ > Koha/Schema/Result/IdentityProviderMapping.pm | 129 ++++++++++++++ > 5 files changed, 441 insertions(+), 25 deletions(-) > create mode 100644 Koha/Schema/Result/Hostname.pm > create mode 100644 Koha/Schema/Result/IdentityProviderHostname.pm > create mode 100644 Koha/Schema/Result/IdentityProviderMapping.pm > >diff --git a/Koha/Schema/Result/Hostname.pm b/Koha/Schema/Result/Hostname.pm >new file mode 100644 >index 00000000000..660973c8848 >--- /dev/null >+++ b/Koha/Schema/Result/Hostname.pm >@@ -0,0 +1,98 @@ >+use utf8; >+package Koha::Schema::Result::Hostname; >+ >+# Created by DBIx::Class::Schema::Loader >+# DO NOT MODIFY THE FIRST PART OF THIS FILE >+ >+=head1 NAME >+ >+Koha::Schema::Result::Hostname - Canonical hostname registry for identity provider selection >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use base 'DBIx::Class::Core'; >+ >+=head1 TABLE: C<hostnames> >+ >+=cut >+ >+__PACKAGE__->table("hostnames"); >+ >+=head1 ACCESSORS >+ >+=head2 hostname_id >+ >+ data_type: 'integer' >+ is_auto_increment: 1 >+ is_nullable: 0 >+ >+Unique identifier for this hostname >+ >+=head2 hostname >+ >+ data_type: 'varchar' >+ is_nullable: 0 >+ size: 255 >+ >+Server hostname string >+ >+=cut >+ >+__PACKAGE__->add_columns( >+ "hostname_id", >+ { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, >+ "hostname", >+ { data_type => "varchar", is_nullable => 0, size => 255 }, >+); >+ >+=head1 PRIMARY KEY >+ >+=over 4 >+ >+=item * L</hostname_id> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->set_primary_key("hostname_id"); >+ >+=head1 UNIQUE CONSTRAINTS >+ >+=head2 C<hostname> >+ >+=over 4 >+ >+=item * L</hostname> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->add_unique_constraint("hostname", ["hostname"]); >+ >+=head1 RELATIONS >+ >+=head2 identity_provider_hostnames >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::IdentityProviderHostname> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "identity_provider_hostnames", >+ "Koha::Schema::Result::IdentityProviderHostname", >+ { "foreign.hostname_id" => "self.hostname_id" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07051 @ 2026-02-20 10:20:26 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uvzH69NxZ1akNcfsvgRDIg >+ >+1; >diff --git a/Koha/Schema/Result/IdentityProvider.pm b/Koha/Schema/Result/IdentityProvider.pm >index ac9c02edaab..5c05f3d9cea 100644 >--- a/Koha/Schema/Result/IdentityProvider.pm >+++ b/Koha/Schema/Result/IdentityProvider.pm >@@ -50,7 +50,7 @@ Description for the provider > =head2 protocol > > data_type: 'enum' >- extra: {list => ["OAuth","OIDC","LDAP","CAS"]} >+ extra: {list => ["OAuth","OIDC","SAML2"]} > is_nullable: 0 > > Protocol provider speaks >@@ -62,20 +62,13 @@ Protocol provider speaks > > Configuration of the provider in JSON format > >-=head2 mapping >+=head2 enabled > >- data_type: 'longtext' >+ data_type: 'tinyint' >+ default_value: 1 > is_nullable: 0 > >-Configuration to map provider data to Koha user >- >-=head2 matchpoint >- >- data_type: 'enum' >- extra: {list => ["email","userid","cardnumber"]} >- is_nullable: 0 >- >-The patron attribute to be used as matchpoint >+Whether this provider is active > > =head2 icon_url > >@@ -97,19 +90,13 @@ __PACKAGE__->add_columns( > "protocol", > { > data_type => "enum", >- extra => { list => ["OAuth", "OIDC", "LDAP", "CAS"] }, >+ extra => { list => ["OAuth", "OIDC", "SAML2"] }, > is_nullable => 0, > }, > "config", > { data_type => "longtext", is_nullable => 0 }, >- "mapping", >- { data_type => "longtext", is_nullable => 0 }, >- "matchpoint", >- { >- data_type => "enum", >- extra => { list => ["email", "userid", "cardnumber"] }, >- is_nullable => 0, >- }, >+ "enabled", >+ { data_type => "tinyint", default_value => 1, is_nullable => 0 }, > "icon_url", > { data_type => "varchar", is_nullable => 1, size => 255 }, > ); >@@ -157,9 +144,39 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >+=head2 identity_provider_hostnames >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::IdentityProviderHostname> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "identity_provider_hostnames", >+ "Koha::Schema::Result::IdentityProviderHostname", >+ { "foreign.identity_provider_id" => "self.identity_provider_id" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ >+=head2 identity_provider_mappings >+ >+Type: has_many >+ >+Related object: L<Koha::Schema::Result::IdentityProviderMapping> >+ >+=cut >+ >+__PACKAGE__->has_many( >+ "identity_provider_mappings", >+ "Koha::Schema::Result::IdentityProviderMapping", >+ { "foreign.identity_provider_id" => "self.identity_provider_id" }, >+ { cascade_copy => 0, cascade_delete => 0 }, >+); >+ > >-# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-11-10 13:01:32 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xSD/bRC3hJCF+nP/EYwn3Q >+# Created by DBIx::Class::Schema::Loader v0.07051 @ 2026-02-21 07:16:46 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4T1F2ggwQdvVV7jskMZwig > > __PACKAGE__->has_many( > "domains", >diff --git a/Koha/Schema/Result/IdentityProviderDomain.pm b/Koha/Schema/Result/IdentityProviderDomain.pm >index 341d1a67090..9a0af083e8c 100644 >--- a/Koha/Schema/Result/IdentityProviderDomain.pm >+++ b/Koha/Schema/Result/IdentityProviderDomain.pm >@@ -105,6 +105,14 @@ Allow user auto register (OPAC) > > Allow user auto register (Staff interface) > >+=head2 send_welcome_email >+ >+ data_type: 'tinyint' >+ default_value: 0 >+ is_nullable: 0 >+ >+Send welcome email to patron on first login >+ > =cut > > __PACKAGE__->add_columns( >@@ -128,6 +136,8 @@ __PACKAGE__->add_columns( > { data_type => "tinyint", default_value => 0, is_nullable => 0 }, > "auto_register_staff", > { data_type => "tinyint", default_value => 0, is_nullable => 0 }, >+ "send_welcome_email", >+ { data_type => "tinyint", default_value => 0, is_nullable => 0 }, > ); > > =head1 PRIMARY KEY >@@ -216,8 +226,8 @@ __PACKAGE__->belongs_to( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-08-22 18:15:05 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GpRUQgJ3WUt9nAAS0E9qWw >+# Created by DBIx::Class::Schema::Loader v0.07051 @ 2026-02-21 07:16:46 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7M7qCu+9WGNjvvaqxyL6Aw > > __PACKAGE__->add_columns( > '+auto_register_opac' => { is_boolean => 1 }, >diff --git a/Koha/Schema/Result/IdentityProviderHostname.pm b/Koha/Schema/Result/IdentityProviderHostname.pm >new file mode 100644 >index 00000000000..039362c86bf >--- /dev/null >+++ b/Koha/Schema/Result/IdentityProviderHostname.pm >@@ -0,0 +1,162 @@ >+use utf8; >+package Koha::Schema::Result::IdentityProviderHostname; >+ >+# Created by DBIx::Class::Schema::Loader >+# DO NOT MODIFY THE FIRST PART OF THIS FILE >+ >+=head1 NAME >+ >+Koha::Schema::Result::IdentityProviderHostname >+ >+=head1 DESCRIPTION >+ >+Maps server hostnames to identity providers (many-to-many). A hostname may be linked to multiple providers. >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use base 'DBIx::Class::Core'; >+ >+=head1 TABLE: C<identity_provider_hostnames> >+ >+=cut >+ >+__PACKAGE__->table("identity_provider_hostnames"); >+ >+=head1 ACCESSORS >+ >+=head2 identity_provider_hostname_id >+ >+ data_type: 'integer' >+ is_auto_increment: 1 >+ is_nullable: 0 >+ >+unique key, used to identify the hostname entry >+ >+=head2 hostname_id >+ >+ data_type: 'integer' >+ is_foreign_key: 1 >+ is_nullable: 0 >+ >+FK to hostnames table >+ >+=head2 identity_provider_id >+ >+ data_type: 'integer' >+ is_foreign_key: 1 >+ is_nullable: 0 >+ >+Identity provider associated with this hostname >+ >+=head2 is_enabled >+ >+ data_type: 'tinyint' >+ default_value: 1 >+ is_nullable: 0 >+ >+Whether this hostname is active for this provider >+ >+=head2 force_sso >+ >+ data_type: 'tinyint' >+ default_value: 0 >+ is_nullable: 0 >+ >+Force SSO redirect for users on this hostname >+ >+=head2 matchpoint >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 255 >+ >+Koha field used to match incoming users against existing patrons >+ >+=cut >+ >+__PACKAGE__->add_columns( >+ "identity_provider_hostname_id", >+ { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, >+ "hostname_id", >+ { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, >+ "identity_provider_id", >+ { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, >+ "is_enabled", >+ { data_type => "tinyint", default_value => 1, is_nullable => 0 }, >+ "force_sso", >+ { data_type => "tinyint", default_value => 0, is_nullable => 0 }, >+ "matchpoint", >+ { data_type => "varchar", is_nullable => 1, size => 255 }, >+); >+ >+=head1 PRIMARY KEY >+ >+=over 4 >+ >+=item * L</identity_provider_hostname_id> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->set_primary_key("identity_provider_hostname_id"); >+ >+=head1 UNIQUE CONSTRAINTS >+ >+=head2 C<hostname_id_provider> >+ >+=over 4 >+ >+=item * L</hostname_id> >+ >+=item * L</identity_provider_id> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->add_unique_constraint( >+ "hostname_id_provider", >+ ["hostname_id", "identity_provider_id"], >+); >+ >+=head1 RELATIONS >+ >+=head2 hostname >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::Hostname> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "hostname", >+ "Koha::Schema::Result::Hostname", >+ { hostname_id => "hostname_id" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "RESTRICT" }, >+); >+ >+=head2 identity_provider >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::IdentityProvider> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "identity_provider", >+ "Koha::Schema::Result::IdentityProvider", >+ { identity_provider_id => "identity_provider_id" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "RESTRICT" }, >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07051 @ 2026-02-21 07:16:46 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:K31ZTdC8ZmSuuKPACLnrUQ >+ >+1; >diff --git a/Koha/Schema/Result/IdentityProviderMapping.pm b/Koha/Schema/Result/IdentityProviderMapping.pm >new file mode 100644 >index 00000000000..81e94fbf989 >--- /dev/null >+++ b/Koha/Schema/Result/IdentityProviderMapping.pm >@@ -0,0 +1,129 @@ >+use utf8; >+package Koha::Schema::Result::IdentityProviderMapping; >+ >+# Created by DBIx::Class::Schema::Loader >+# DO NOT MODIFY THE FIRST PART OF THIS FILE >+ >+=head1 NAME >+ >+Koha::Schema::Result::IdentityProviderMapping >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use base 'DBIx::Class::Core'; >+ >+=head1 TABLE: C<identity_provider_mappings> >+ >+=cut >+ >+__PACKAGE__->table("identity_provider_mappings"); >+ >+=head1 ACCESSORS >+ >+=head2 mapping_id >+ >+ data_type: 'integer' >+ is_auto_increment: 1 >+ is_nullable: 0 >+ >+primary key >+ >+=head2 identity_provider_id >+ >+ data_type: 'integer' >+ is_foreign_key: 1 >+ is_nullable: 0 >+ >+Reference to identity provider >+ >+=head2 provider_field >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 255 >+ >+Attribute name from the identity provider >+ >+=head2 koha_field >+ >+ data_type: 'varchar' >+ is_nullable: 0 >+ size: 255 >+ >+Corresponding field in Koha borrowers table >+ >+=head2 default_content >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 255 >+ >+Default value if provider does not supply this field >+ >+=cut >+ >+__PACKAGE__->add_columns( >+ "mapping_id", >+ { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, >+ "identity_provider_id", >+ { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, >+ "provider_field", >+ { data_type => "varchar", is_nullable => 1, size => 255 }, >+ "koha_field", >+ { data_type => "varchar", is_nullable => 0, size => 255 }, >+ "default_content", >+ { data_type => "varchar", is_nullable => 1, size => 255 }, >+); >+ >+=head1 PRIMARY KEY >+ >+=over 4 >+ >+=item * L</mapping_id> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->set_primary_key("mapping_id"); >+ >+=head1 UNIQUE CONSTRAINTS >+ >+=head2 C<provider_koha_field> >+ >+=over 4 >+ >+=item * L</identity_provider_id> >+ >+=item * L</koha_field> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->add_unique_constraint("provider_koha_field", ["identity_provider_id", "koha_field"]); >+ >+=head1 RELATIONS >+ >+=head2 identity_provider >+ >+Type: belongs_to >+ >+Related object: L<Koha::Schema::Result::IdentityProvider> >+ >+=cut >+ >+__PACKAGE__->belongs_to( >+ "identity_provider", >+ "Koha::Schema::Result::IdentityProvider", >+ { identity_provider_id => "identity_provider_id" }, >+ { is_deferrable => 1, on_delete => "CASCADE", on_update => "RESTRICT" }, >+); >+ >+ >+# Created by DBIx::Class::Schema::Loader v0.07051 @ 2026-02-20 10:20:26 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:x2JmD4As/a96Ndoe5rzuKg >+1; >-- >2.53.0 >
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 39224
:
189234
|
189235
|
189236
|
189237
|
189238
|
189239
|
189240
|
189241
|
189242
|
189243
|
189244
|
193618
|
193619
|
193620
|
193621
|
193622
|
193623
|
193624
|
193625
|
193626
|
193627
|
193681
| 193682 |
193683
|
193684
|
193685
|
193686
|
193687
|
193688
|
193689
|
193690
|
193691
|
193692