[% END %]
[% IF CAN_user_borrowers_edit_borrowers %]
- <li><a id="apikeys" href="/cgi-bin/koha/members/apikeys.pl?patron_id=[% borrowernumber %]">Manage API keys</a></li>
+ <li><a id="apikeys" href="/cgi-bin/koha/members/apikeys.pl?patron_id=[% patron.borrowernumber %]">Manage API keys</a></li>
[% ELSE %]
<li class="disabled"><a data-toggle="tooltip" data-placement="left" title="You are not authorized to manage API keys" id="apikeys" href="#">Manage API keys</a></li>
[% END %]
<input type="hidden" name="patron_id" value="[% patron.id %]" />
<input type="hidden" name="op" value="generate" />
<fieldset class="brief">
- <legend>Generate new key</legend>
+ <legend>Generate new client id/secret pair</legend>
<ol>
<li>
<label for="description">Description: </label>
<div id="keys">
[% IF api_keys && api_keys.size > 0 %]
<p>
- <button class="btn btn-default btn-xs toggle_element" type="submit" id="show-api-form" data-element="#add-api-key"><i class="fa fa-plus"></i> Generate a new key</button>
+ <button class="btn btn-default btn-xs toggle_element" type="submit" id="show-api-form" data-element="#add-api-key"><i class="fa fa-plus"></i> Generate a new client id/key pair</button>
</p>
<table>
<thead>
<tr>
<th>Description</th>
- <th>Key</th>
+ <th>Client ID</th>
+ <th>Secret</th>
<th>Active</th>
<th>Actions</th>
</tr>
[% FOREACH key IN api_keys %]
<tr>
<td>[% key.description %]</td>
- <td>[% key.value %]</td>
+ <td>[% key.client_id %]</td>
+ <td>[% key.secret %]</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="patron_id" value="[% patron.id %]" />
- <input type="hidden" name="key" value="[% key.value %]" />
+ <input type="hidden" name="key" value="[% key.id %]" />
<input type="hidden" name="op" value="delete" />
<button class="btn btn-default btn-xs delete" type="submit"><i class="fa fa-trash"></i> Delete</button>
</form>
<form action="/cgi-bin/koha/members/apikeys.pl" method="post">
<input type="hidden" name="patron_id" value="[% patron.id %]" />
- <input type="hidden" name="key" value="[% key.value %]" />
+ <input type="hidden" name="key" value="[% key.id %]" />
[% IF key.active %]
<input type="hidden" name="op" value="revoke" />
<button class="btn btn-default btn-xs" type="submit"><i class="fa fa-remove"></i> Revoke</button>
</tbody>
</table>
[% ELSE %]
- <div class="dialog message">No keys defined for the current patron. <a href="#" class="toggle_element" data-element="#add-api-key" id="show-api-form"><i class="fa fa-plus"></i> Generate a new key</div>
+ <div class="dialog message">No keys defined for the current patron. <a href="#" class="toggle_element" data-element="#add-api-key" id="show-api-form"><i class="fa fa-plus"></i> Generate a new client id/secret pair</div>
[% END %]
</div>
</div>
</p>
<form id="add-api-key" action="/cgi-bin/koha/opac-apikeys.pl" method="post">
<fieldset>
- <legend>Generate new key</legend>
+ <legend>Generate new client id/secret pair</legend>
<input type="hidden" name="patron_id" value="[% patron.id %]" />
<input type="hidden" name="op" value="generate" />
<label for="description">Description: </label>
<thead>
<tr>
<th>Description</th>
- <th>Key</th>
+ <th>Client ID</th>
+ <th>Secret</th>
<th>Active</th>
<th>Actions</th>
</tr>
[% FOREACH key IN api_keys %]
<tr>
<td>[% key.description %]</td>
- <td>[% key.value %]</td>
+ <td>[% key.client_id %]</td>
+ <td>[% key.secret %]</td>
<td>[% IF key.active %]Yes[% ELSE %]No[% END %]</td>
<td>
<form action="/cgi-bin/koha/opac-apikeys.pl" method="post" class="form-inline">
- <input type="hidden" name="key" value="[% key.value %]" />
+ <input type="hidden" name="key" value="[% key.id %]" />
<input type="hidden" name="op" value="delete" />
<button class="btn btn-link btn-xs delete-key" type="submit"><i class="fa fa-trash"></i> Delete</button>
</form>
<form action="/cgi-bin/koha/opac-apikeys.pl" method="post" class="form-inline">
- <input type="hidden" name="key" value="[% key.value %]" />
+ <input type="hidden" name="key" value="[% key.id %]" />
[% IF key.active %]
<input type="hidden" name="op" value="revoke" />
<button class="btn btn-link btn-xs" type="submit"><i class="fa fa-remove"></i> Revoke</button>
}
if ( $op eq 'delete' ) {
- my $api_key = $cgi->param('key');
- my $key = Koha::ApiKeys->find({ patron_id => $patron_id, value => $api_key });
+ my $api_key_id = $cgi->param('key');
+ my $key = Koha::ApiKeys->find({ patron_id => $patron_id, id => $api_key_id });
if ($key) {
$key->delete;
}
}
if ( $op eq 'revoke' ) {
- my $api_key = $cgi->param('key');
- my $key = Koha::ApiKeys->find({ patron_id => $patron_id, value => $api_key });
+ my $api_key_id = $cgi->param('key');
+ my $key = Koha::ApiKeys->find({ patron_id => $patron_id, id => $api_key_id });
if ($key) {
$key->active(0);
$key->store;
}
if ( $op eq 'activate' ) {
- my $api_key = $cgi->param('key');
- my $key = Koha::ApiKeys->find({ patron_id => $patron_id, value => $api_key });
+ my $api_key_id = $cgi->param('key');
+ my $key = Koha::ApiKeys->find({ patron_id => $patron_id, id => $api_key_id });
if ($key) {
$key->active(1);
$key->store;
exit;
}
-
my $op = $cgi->param('op');
if ($op) {
}
if ($op eq 'delete') {
- my $key = $cgi->param('key');
- my $api_key = Koha::ApiKeys->find({ patron_id => $patron_id, value => $key});
+ my $key_id = $cgi->param('key');
+ my $api_key = Koha::ApiKeys->find({ patron_id => $patron_id, id => $key_id });
if ($api_key) {
$api_key->delete;
}
}
if ($op eq 'revoke') {
- my $key = $cgi->param('key');
- my $api_key = Koha::ApiKeys->find({ patron_id => $patron_id, value => $key });
+ my $key_id = $cgi->param('key');
+ my $api_key = Koha::ApiKeys->find({ patron_id => $patron_id, id => $key_id });
if ($api_key) {
$api_key->active(0);
$api_key->store;
}
if ($op eq 'activate') {
- my $key = $cgi->param('key');
- my $api_key = Koha::ApiKeys->find({ patron_id => $patron_id, value => $key });
+ my $key_id = $cgi->param('key');
+ my $api_key = Koha::ApiKeys->find({ patron_id => $patron_id, id => $key_id });
if ($api_key) {
$api_key->active(1);
$api_key->store;