Merge pull request #7468 from righel/add-openapi-spec

Add openapi spec
pull/7479/head
Andras Iklody 2021-06-04 15:57:33 +02:00 committed by GitHub
commit 83ca1efd87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 7466 additions and 7 deletions

View File

@ -537,6 +537,7 @@ class ACLComponent extends Component
'resetRemoteAuthKey' => array(),
'removeOrphanedCorrelations' => array('perm_site_admin'),
'rest' => array('perm_auth'),
'openapi' => array('*'),
'restartDeadWorkers' => array(),
'restartWorkers' => array(),
'serverSettings' => array(),

View File

@ -2527,4 +2527,7 @@ misp.direct_call(relative_path, body)
$syncFilteringRules = $this->Server->getAvailableSyncFilteringRules($this->Auth->user());
return $this->RestResponse->viewData($syncFilteringRules);
}
public function openapi() {
}
}

View File

@ -98,7 +98,7 @@ class Organisation extends AppModel
'uuid' => '0',
'contacts' => '',
'local' => true,
'restricted_to_domain' => '[]',
'restricted_to_domain' => [],
'landingpage' => null
);

View File

@ -1556,6 +1556,23 @@ $divider = $this->element('/genericElements/SideMenu/side_menu_divider');
));
}
break;
case 'api':
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
'element_id' => 'openapi',
'url' => $baseurl . '/servers/openapi',
'text' => __('OpenAPI')
));
if ($isAclAdd) {
if ($canAccess('servers', 'rest')) {
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
'element_id' => 'rest',
'url' => $baseurl . '/servers/rest',
'text' => __('REST client')
));
}
}
break;
}
?>
</ul>

View File

@ -33,11 +33,6 @@
'text' => __('Search Attributes'),
'url' => $baseurl . '/attributes/search'
),
array(
'text' => __('REST client'),
'url' => $baseurl . '/servers/rest',
'requirement' => $canAccess('servers', 'rest'),
),
array(
'type' => 'separator'
),
@ -476,6 +471,21 @@
'url' => $baseurl . '/admin/logs/search'
)
)
),
array(
'type' => 'root',
'text' => __('API'),
'children' => array(
array(
'text' => __('OpenAPI'),
'url' => $baseurl . '/servers/openapi'
),
array(
'text' => __('REST client'),
'url' => $baseurl . '/servers/rest',
'requirement' => $canAccess('servers', 'rest')
)
)
)
);
$menu_right = array(

View File

@ -3,6 +3,7 @@
?>
<div class="event index">
<h2><?php echo __('Automation');?></h2>
<p class="bold"><?php echo __('Check out the OpenAPI spec of the MISP Automation API <a href="%s">here</a>.', $baseurl . '/servers/openapi');?></p>
<p><?php echo __('Automation functionality is designed to automatically feed other tools and systems with the data in your MISP repository.
To to make this functionality available for automated tools an authentication key is used.');?>
<br /><?php echo __('You can use the <a href="' . $baseurl . '/servers/rest">REST client</a> to test your API queries against your MISP and export the resulting tuned queries as curl or python scripts.');?>

View File

@ -0,0 +1,13 @@
<?php
echo $this->element('genericElements/assetLoader', array(
'js' => array('redoc.standalone')
));
?>
<div id="redoc-container"></div>
<script>
Redoc.init('/doc/openapi.yaml', {
fontFamily: "inherit",
disableSearch: true,
expandResponses: "200"
}, document.getElementById('redoc-container'))
</script>

View File

@ -189,7 +189,7 @@
</div>
<?php
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'event-collection', 'menuItem' => 'rest'));
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'api', 'menuItem' => 'rest'));
echo $this->element('genericElements/assetLoader', array(
'js' => array(
'moment.min',

7306
app/webroot/doc/openapi.yaml Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long