3aa102d0c3
This introduces the concept of API keys for use in the new REST API. A key is a string of 32 alphanumerical characters (32 is purely arbitrary, it can be changed easily). A user can have multiple keys (unlimited at the moment) Keys can be generated automatically, and then we have the possibility to delete or revoke each one individually. Test plan: 1/ Go to staff interface 2/ Go to a borrower page 3/ In toolbar, click on More -> Manage API keys 4/ Click on "Generate new key" multiple times, check that they are correctly displayed under the button, and they are active by default 5/ Revoke some keys, check that they are not active anymore 6/ Delete some keys, check that they disappear from table 7/ Go to opac interface, log in 8/ In your user account pages, you now have a new tab to the left "your API keys". Click on it. 9/ Repeat steps 4-6 Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
76 lines
2.7 KiB
Text
76 lines
2.7 KiB
Text
[% USE Koha %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Patrons [% IF ( searching ) %]› API Keys[% END %]</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
</head>
|
|
<body id="pat_apikeys" class="pat">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'patron-search.inc' %]
|
|
|
|
<div id="breadcrumbs">
|
|
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
|
|
›
|
|
<a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
|
|
›
|
|
API Keys for [% INCLUDE 'patron-title.inc' %]
|
|
</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
[% INCLUDE 'members-toolbar.inc' %]
|
|
|
|
<h1>API keys for [% INCLUDE 'patron-title.inc' %]</h1>
|
|
<div>
|
|
<form action="/cgi-bin/koha/members/apikeys.pl" method="post">
|
|
<input type="hidden" name="borrowernumber" value="[% borrowernumber %]">
|
|
<input type="hidden" name="op" value="generate">
|
|
<input type="submit" value="Generate new key">
|
|
</form>
|
|
</div>
|
|
[% IF api_keys.size > 0 %]
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Key</th>
|
|
<th>Active</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOREACH key IN api_keys %]
|
|
<tr>
|
|
<td>[% key.api_key %]</td>
|
|
<td>[% IF key.active %]Yes[% ELSE %]No[% END %]</td>
|
|
<td>
|
|
<form action="/cgi-bin/koha/members/apikeys.pl" method="post">
|
|
<input type="hidden" name="borrowernumber" value="[% borrowernumber %]">
|
|
<input type="hidden" name="key" value="[% key.api_key %]">
|
|
<input type="hidden" name="op" value="delete">
|
|
<input type="submit" value="Delete">
|
|
</form>
|
|
<form action="/cgi-bin/koha/members/apikeys.pl" method="post">
|
|
<input type="hidden" name="borrowernumber" value="[% borrowernumber %]">
|
|
<input type="hidden" name="key" value="[% key.api_key %]">
|
|
[% IF key.active %]
|
|
<input type="hidden" name="op" value="revoke">
|
|
<input type="submit" value="Revoke">
|
|
[% ELSE %]
|
|
<input type="hidden" name="op" value="activate">
|
|
<input type="submit" value="Activate">
|
|
[% END %]
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
[% END %]
|
|
</div>
|
|
</div>
|
|
<div class="yui-b">
|
|
[% INCLUDE 'circ-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|