Bugzilla – Attachment 171014 Details for
Bug 37025
Add CLI tool to generate/delete api keys for a given patron on a Koha instance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37025: (follow-up) Wrap calls to koha modules in koha-shell
Bug-37025-follow-up-Wrap-calls-to-koha-modules-in-.patch (text/plain), 2.10 KB, created by
Paul Derscheid
on 2024-09-04 09:43:29 UTC
(
hide
)
Description:
Bug 37025: (follow-up) Wrap calls to koha modules in koha-shell
Filename:
MIME Type:
Creator:
Paul Derscheid
Created:
2024-09-04 09:43:29 UTC
Size:
2.10 KB
patch
obsolete
>From 34007f33f4a19c23b7259e78e71c88c84eb30d33 Mon Sep 17 00:00:00 2001 >From: Paul Derscheid <paul.derscheid@lmscloud.de> >Date: Wed, 4 Sep 2024 11:39:43 +0200 >Subject: [PATCH] Bug 37025: (follow-up) Wrap calls to koha modules in > koha-shell > >This change should >- allow seamless usage when run as root (implied by /usr/sbin). >- give explicit control to the user instead of relying on the environment >--- > debian/scripts/koha-api-keys | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > >diff --git a/debian/scripts/koha-api-keys b/debian/scripts/koha-api-keys >index 774912e297..79878e8450 100755 >--- a/debian/scripts/koha-api-keys >+++ b/debian/scripts/koha-api-keys >@@ -62,8 +62,7 @@ if [ "$op" == 'generate' ]; then > usage > die "Unknown instance '$instance'" > ) >- >- if ! perl -MKoha::Patrons -e "Koha::Patrons->find($borrowernumber) or die;" 2>/dev/null; then >+ if ! koha-shell -c "perl -MKoha::Patrons -e \"Koha::Patrons->find($borrowernumber) or die;\"" "$instance" 2>/dev/null; then > die "Unknown borrowernumber: '$borrowernumber'" > fi > >@@ -71,7 +70,7 @@ if [ "$op" == 'generate' ]; then > read -r client_id > read -r secret > } < <( >- perl -MKoha::ApiKeys -e "my \$key = Koha::ApiKey->new( { patron_id => $borrowernumber, description => '$description' } )->store; printf \"%s\n%s\n\", \$key->client_id, \$key->plain_text_secret;" >+ koha-shell -c "perl -MKoha::ApiKeys -e \"my \\\$key = Koha::ApiKey->new( { patron_id => $borrowernumber, description => '$description' } )->store; printf \\\"%s\\n%s\\n\\\", \\\$key->client_id, \\\$key->plain_text_secret;\"" "$instance" > ) > > printf "Client ID:\t%s\nClient Secret:\t%s\n" "$client_id" "$secret" >@@ -87,7 +86,7 @@ if [ "$op" == 'delete' ]; then > ) > > read -rp "Client ID to delete: " client_id >- if ! perl -MKoha::ApiKeys -e "Koha::ApiKeys->find('$client_id')->delete or die;" 2>/dev/null; then >+ if ! koha-shell -c "perl -MKoha::ApiKeys -e \"Koha::ApiKeys->find(\\\"$client_id\\\")->delete or die;\"" "$instance" 2>/dev/null; then > die "Unknown client id: '$client_id'" > fi > >-- >2.46.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 37025
:
167397
|
167524
| 171014