chg: [diagnostic] Exposed dbSchemaDiagnostic to the API

pull/5390/head
mokaddem 2019-11-08 13:52:00 +01:00
parent 7707acdf1a
commit f03a5c7b5f
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 9 additions and 0 deletions

View File

@ -356,6 +356,7 @@ class ACLComponent extends Component
),
'servers' => array(
'add' => array(),
'dbSchemaDiagnostic' => array(),
'cache' => array(),
'changePriority' => array(),
'checkout' => array(),

View File

@ -2185,4 +2185,12 @@ misp.direct_call(relative_path, body)
$this->Server->resetUpdateFailNumber();
$this->redirect(array('action' => 'updateProgress'));
}
public function dbSchemaDiagnostic()
{
if (!$this->_isSiteAdmin()) {
throw new MethodNotAllowedException(__('Only site admin accounts get the DB schema diagnostic.'));
}
return $this->RestResponse->viewData($this->Server->dbSchemaDiagnostic(), $this->response->type());
}
}