https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37025

Katrin Fischer <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #185537|0                           |1
        is obsolete|                            |

--- Comment #31 from Katrin Fischer <[email protected]> ---
Created attachment 191642
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191642&action=edit
Bug 37025: (follow-up) Use consistent option handling and convert to Perl

- Convert from bash to Perl for less headaches regarding quoting
- Replace positional arguments with --generate and --delete flags
- Add --description, --borrowernumber, and --client-id options
- Add POD following Koha standards
- Update DocBook XML documentation with new flag-based interface
- Add audit logging for all API key operations via C4::Log
- Document proper usage via koha-shell wrapper for administrative access

Test plan:
NOTE: As this tool requires Koha environment access and is installed to
/usr/sbin/,
it must be run via koha-shell when using sudo:
1. Test help output:
   sudo koha-shell -c "koha-api-keys --help" instancename
2. Test API key generation:
   sudo koha-shell -c "koha-api-keys --generate --description 'Test key'
--borrowernumber 51" instancename
   => Should output Client ID and Client Secret in tab-separated format
3. Test interactive deletion (use echo to provide input):
   echo "CLIENT_ID_FROM_STEP_2" | sudo koha-shell -c "koha-api-keys --delete"
instancename
   => Should delete successfully
4. Test scripted deletion:
   sudo koha-shell -c "koha-api-keys --delete --client-id
CLIENT_ID_FROM_STEP_2" instancename
   => Should delete without prompting
5. Test error handling:
   sudo koha-shell -c "koha-api-keys --generate --description test"
instancename
   => Should show error about missing --borrowernumber
6. Test invalid data:
   sudo koha-shell -c "koha-api-keys --generate --description test
--borrowernumber 99999" instancename
   => Should show error about unknown borrowernumber
7. Verify audit logging:
   After steps 2 and 4, check action_logs table for APIKEY entries:
   sudo koha-mysql instancename -e "SELECT timestamp, module, action, object,
info FROM action_logs WHERE module='APIKEY' ORDER BY timestamp DESC LIMIT 5;"
   => Should show logged generation and deletion operations
8. Verify DocBook XML validation:
   prove -v xt/verify-debian-docbook.t
9. Generate and verify man page:
   xsltproc
/usr/share/xml/docbook/stylesheet/docbook-xsl-ns/manpages/docbook.xsl
debian/docs/koha-api-keys.xml
   => Should generate koha-api-keys.8 without errors

Signed-off-by: Katrin Fischer <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to