From 12ff0c42badf6c3a1f1f4d156d5a0fb941c792ef Mon Sep 17 00:00:00 2001 From: Jacob O'Mara Date: Wed, 17 Sep 2025 10:17:38 +0100 Subject: [PATCH] Bug 40824: DBIC - DO NOT PUSH --- Koha/Schema/Result/Borrower.pm | 19 +++- Koha/Schema/Result/BorrowerPasswordHistory.pm | 104 ++++++++++++++++++ Koha/Schema/Result/Category.pm | 13 ++- 3 files changed, 132 insertions(+), 4 deletions(-) create mode 100644 Koha/Schema/Result/BorrowerPasswordHistory.pm diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 1e1fa11cd42..ee1b8058c77 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -1151,6 +1151,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 borrower_password_histories + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "borrower_password_histories", + "Koha::Schema::Result::BorrowerPasswordHistory", + { "foreign.borrowernumber" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 borrower_relationships_guarantees Type: has_many @@ -2197,8 +2212,8 @@ Composing rels: L -> permission __PACKAGE__->many_to_many("permissions", "user_permissions", "permission"); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-07-10 07:11:31 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:XFOe2X4k2DUziaNS5pWd/Q +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-09-17 09:14:33 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RQvOJOjtD9E4Q6QEkLWlCA __PACKAGE__->belongs_to( "library", diff --git a/Koha/Schema/Result/BorrowerPasswordHistory.pm b/Koha/Schema/Result/BorrowerPasswordHistory.pm new file mode 100644 index 00000000000..dd778ef19fa --- /dev/null +++ b/Koha/Schema/Result/BorrowerPasswordHistory.pm @@ -0,0 +1,104 @@ +use utf8; +package Koha::Schema::Result::BorrowerPasswordHistory; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::BorrowerPasswordHistory + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("borrower_password_history"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 borrowernumber + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 password + + data_type: 'varchar' + is_nullable: 0 + size: 128 + +=head2 created_on + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: current_timestamp + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "borrowernumber", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "password", + { data_type => "varchar", is_nullable => 0, size => 128 }, + "created_on", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + default_value => \"current_timestamp", + is_nullable => 0, + }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 borrowernumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "borrowernumber", + "Koha::Schema::Result::Borrower", + { borrowernumber => "borrowernumber" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-09-17 09:14:33 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/qbG6KZnnD+JxaiXpTkdgg + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/Category.pm b/Koha/Schema/Result/Category.pm index 9cb9622295a..232772a2d36 100644 --- a/Koha/Schema/Result/Category.pm +++ b/Koha/Schema/Result/Category.pm @@ -173,6 +173,13 @@ if patrons of this category can do the password reset flow, if patrons of this category can change their passwords in the OAPC +=head2 password_history_count + + data_type: 'smallint' + is_nullable: 1 + +Number of previous passwords to check against when changing password for this patron type + =head2 min_password_length data_type: 'smallint' @@ -287,6 +294,8 @@ __PACKAGE__->add_columns( { data_type => "tinyint", is_nullable => 1 }, "change_password", { data_type => "tinyint", is_nullable => 1 }, + "password_history_count", + { data_type => "smallint", is_nullable => 1 }, "min_password_length", { data_type => "smallint", is_nullable => 1 }, "require_strong_password", @@ -410,8 +419,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-07-10 07:11:31 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ADt+iDjteg9Jb81L2FMIvg +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-09-17 09:14:33 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SRkD2XmAHHpuJFnrftAXyA # You can replace this text with custom code or comments, and it will be preserved on regeneration -- 2.39.5