From e502f21f6eba04613e51e5b31e211271b90dced0 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 11 Feb 2022 13:34:37 +0000 Subject: [PATCH] Bug 29924: (follow-up) Add password_expiration_date to API Signed-off-by: Owen Leonard --- api/v1/swagger/definitions/patron.yaml | 7 +++++++ api/v1/swagger/paths/patrons.yaml | 5 +++++ t/db_dependent/api/v1/patrons.t | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/api/v1/swagger/definitions/patron.yaml b/api/v1/swagger/definitions/patron.yaml index cda77629ce..692819d835 100644 --- a/api/v1/swagger/definitions/patron.yaml +++ b/api/v1/swagger/definitions/patron.yaml @@ -328,6 +328,13 @@ properties: description: patron's extended attributes items: $ref: patron_extended_attribute.yaml + password_expiration_date: + type: + - string + - "null" + format: date + readOnly: true + description: day a patron's password expires and must be changed/reset additionalProperties: false required: - surname diff --git a/api/v1/swagger/paths/patrons.yaml b/api/v1/swagger/paths/patrons.yaml index 76fe6c1bbb..d53d5fe179 100644 --- a/api/v1/swagger/paths/patrons.yaml +++ b/api/v1/swagger/paths/patrons.yaml @@ -189,6 +189,11 @@ description: Case insensitive search on expiry_date required: false type: string + - name: password_expiration_date + in: query + description: Case insensitive search on password_expiration_date + required: false + type: string - name: incorrect_address in: query description: Search on incorrect_address diff --git a/t/db_dependent/api/v1/patrons.t b/t/db_dependent/api/v1/patrons.t index ba064b6392..effe448880 100755 --- a/t/db_dependent/api/v1/patrons.t +++ b/t/db_dependent/api/v1/patrons.t @@ -335,6 +335,7 @@ subtest 'add() tests' => sub { delete $newpatron->{patron_id}; delete $newpatron->{restricted}; delete $newpatron->{anonymized}; + delete $newpatron->{password_expiration_date}; # Create a library just to make sure its ID doesn't exist on the DB my $library_to_delete = $builder->build_object({ class => 'Koha::Libraries' }); @@ -388,6 +389,7 @@ subtest 'add() tests' => sub { delete $newpatron->{patron_id}; delete $newpatron->{restricted}; delete $newpatron->{anonymized}; + delete $newpatron->{password_expiration_date}; $patron_to_delete->delete; # Set a date field @@ -576,6 +578,7 @@ subtest 'update() tests' => sub { delete $newpatron->{patron_id}; delete $newpatron->{restricted}; delete $newpatron->{anonymized}; + delete $newpatron->{password_expiration_date}; $t->put_ok("//$userid:$password@/api/v1/patrons/-1" => json => $newpatron) ->status_is(404) @@ -654,6 +657,7 @@ subtest 'update() tests' => sub { $newpatron->{patron_id} = $unauthorized_patron->to_api->{patron_id}; $newpatron->{restricted} = $unauthorized_patron->to_api->{restricted}; $newpatron->{anonymized} = $unauthorized_patron->to_api->{anonymized}; + $newpatron->{password_expiration_date} = $unauthorized_patron->to_api->{password_expiration_date}; my $got = $result->tx->res->json; my $updated_on_got = delete $got->{updated_on}; @@ -685,6 +689,7 @@ subtest 'update() tests' => sub { delete $newpatron->{patron_id}; delete $newpatron->{restricted}; delete $newpatron->{anonymized}; + delete $newpatron->{password_expiration_date}; # attempt to update $authorized_patron->flags( 2**4 )->store; # borrowers flag = 4 -- 2.30.2