MISP/app/View/AuthKeys/index.ctp

127 lines
4.7 KiB
Plaintext
Raw Normal View History

2020-10-20 01:48:04 +02:00
<?php
if (!$advancedEnabled) {
echo '<div class="alert">' . __('Advanced auth keys are not enabled.') . '</div>';
}
echo sprintf('<div%s>', empty($ajax) ? ' class="index"' : '');
2020-10-20 01:48:04 +02:00
echo $this->element('genericElements/IndexTable/index_table', [
'data' => [
'data' => $data,
'top_bar' => [
'pull' => 'right',
'children' => [
[
'type' => 'simple',
'children' => [
'data' => [
'type' => 'simple',
'text' => __('Add authentication key'),
'class' => 'btn btn-primary',
'onClick' => 'openGenericModal',
'onClickParams' => [
sprintf(
2020-11-13 12:53:52 +01:00
'%s/auth_keys/add%s',
$baseurl,
empty($user_id) ? '' : ('/' . $user_id)
2020-10-20 01:48:04 +02:00
)
]
]
]
],
[
'type' => 'search',
'button' => __('Filter'),
'placeholder' => __('Enter value to search'),
'searchKey' => 'quickFilter',
2020-10-20 01:48:04 +02:00
]
]
],
'fields' => [
[
'name' => '#',
'sort' => 'AuthKey.id',
'data_path' => 'AuthKey.id',
],
[
'name' => __('User'),
'sort' => 'User.email',
'data_path' => 'User.email',
'element' => empty($user_id) ? 'links' : 'generic_field',
'url' => $baseurl . '/users/view',
'url_params_data_paths' => ['User.id'],
2020-10-20 01:48:04 +02:00
],
[
'name' => __('Auth Key'),
2020-10-20 01:48:04 +02:00
'sort' => 'AuthKey.authkey_start',
'element' => 'authkey',
'data_path' => 'AuthKey',
],
[
'name' => __('Expiration'),
'sort' => 'AuthKey.expiration',
'data_path' => 'AuthKey.expiration',
'element' => 'expiration'
],
[
'name' => ('Last used'),
'data_path' => 'AuthKey.last_used',
'element' => 'datetime',
'requirements' => $keyUsageEnabled,
2021-02-27 11:13:47 +01:00
'empty' => __('Never'),
],
2020-10-20 01:48:04 +02:00
[
'name' => __('Comment'),
'sort' => 'AuthKey.comment',
'data_path' => 'AuthKey.comment',
],
2021-02-27 11:13:47 +01:00
[
'name' => __('Allowed IPs'),
'data_path' => 'AuthKey.allowed_ips',
],
2020-10-20 01:48:04 +02:00
],
'title' => empty($ajax) ? __('Authentication key Index') : false,
'description' => empty($ajax) ? __('A list of API keys bound to a user.') : false,
'pull' => 'right',
'actions' => [
[
'url' => $baseurl . '/auth_keys/view',
'url_params_data_paths' => array(
'AuthKey.id'
),
'icon' => 'eye',
2021-02-27 11:13:47 +01:00
'dbclickAction' => true,
'title' => 'View auth key',
],
[
'url' => $baseurl . '/auth_keys/edit',
'url_params_data_paths' => array(
'AuthKey.id'
),
'icon' => 'edit',
'title' => 'Edit auth key',
],
2020-10-20 01:48:04 +02:00
[
'onclick' => sprintf(
'openGenericModal(\'%s/authKeys/delete/[onclick_params_data_path]\');',
$baseurl
),
'onclick_params_data_path' => 'AuthKey.id',
'icon' => 'trash',
'title' => __('Delete auth key'),
2020-10-20 01:48:04 +02:00
]
]
]
]);
echo '</div>';
if (empty($ajax)) {
echo $this->element('/genericElements/SideMenu/side_menu', $menuData);
2020-10-20 01:48:04 +02:00
}
?>
<script type="text/javascript">
var passedArgsArray = <?php echo $passedArgs; ?>;
$(function() {
2020-10-20 01:48:04 +02:00
$('#quickFilterButton').click(function() {
runIndexQuickFilter();
});
});
</script>