Bugzilla – Attachment 111622 Details for
Bug 26595
Add SMTP server column to libraries table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26595: Remove password from the smtp_server API object
Bug-26595-Remove-password-from-the-smtpserver-API-.patch (text/plain), 2.05 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-10-14 13:10:44 UTC
(
hide
)
Description:
Bug 26595: Remove password from the smtp_server API object
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-10-14 13:10:44 UTC
Size:
2.05 KB
patch
obsolete
>From ab41e1ce8d8799b2f095a5f5863ad34d146c7591 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 14 Oct 2020 10:04:24 -0300 >Subject: [PATCH] Bug 26595: Remove password from the smtp_server API object > >This patch makes the SMTP server objects do not include the password for >API representation. If we need the password itself, we can add a route >to retrieve it with specific permissions. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/SMTP/Server.pm | 18 ++++++++++++++++++ > t/db_dependent/Koha/SMTP/Server.t | 14 +++++++++++++- > 2 files changed, 31 insertions(+), 1 deletion(-) > >diff --git a/Koha/SMTP/Server.pm b/Koha/SMTP/Server.pm >index 919f7898b20..d5fec72611b 100644 >--- a/Koha/SMTP/Server.pm >+++ b/Koha/SMTP/Server.pm >@@ -99,6 +99,24 @@ sub is_system_default { > return $self->{_is_system_default}; > } > >+=head3 to_api >+ >+ my $json = $smtp_server->to_api; >+ >+Overloaded method that returns a JSON representation of the Koha::SMTP::Server object, >+suitable for API output. >+ >+=cut >+ >+sub to_api { >+ my ( $self, $params ) = @_; >+ >+ my $json = $self->SUPER::to_api( $params ); >+ delete $json->{password}; >+ >+ return $json; >+} >+ > =head3 to_api_mapping > > This method returns the mapping for representing a Koha::SMTP::Server object >diff --git a/t/db_dependent/Koha/SMTP/Server.t b/t/db_dependent/Koha/SMTP/Server.t >index 23b368320f5..3a1c423e5ef 100755 >--- a/t/db_dependent/Koha/SMTP/Server.t >+++ b/t/db_dependent/Koha/SMTP/Server.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; > use Test::Exception; > use Test::Warn; > >@@ -70,3 +70,15 @@ subtest 'is_system_default() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'to_api() tests' => sub { >+ >+ plan tests => 1; >+ >+ $schema->storage->txn_begin; >+ >+ my $smtp_server = $builder->build_object({ class => 'Koha::SMTP::Servers' }); >+ ok( !exists $smtp_server->to_api->{password}, 'Password is not part of the API representation' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.28.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 26595
:
111122
|
111123
|
111124
|
111125
|
111155
|
111156
|
111157
|
111158
|
111550
|
111551
|
111552
|
111553
|
111606
|
111621
| 111622