mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-19 19:15:22 +00:00
System: Trust: Revocation - add missing delAction()
ref https://forum.opnsense.org/index.php?topic=42340.msg209048#msg209048
This commit is contained in:
parent
7fe558c6b1
commit
59b4defd5b
@ -373,6 +373,35 @@ class CrlController extends ApiControllerBase
|
||||
return ['status' => 'failed'];
|
||||
}
|
||||
|
||||
/**
|
||||
* drop CRL by certificate reference
|
||||
*/
|
||||
public function delAction($caref)
|
||||
{
|
||||
if ($this->request->isPost() && !empty($caref)) {
|
||||
Config::getInstance()->lock();
|
||||
$config = Config::getInstance()->object();
|
||||
$to_delete = [];
|
||||
foreach ($config->crl as $node) {
|
||||
if ((string)$node->caref == $caref) {
|
||||
$to_delete[] = $node;
|
||||
}
|
||||
}
|
||||
foreach ($to_delete as $cert) {
|
||||
$dom = dom_import_simplexml($cert);
|
||||
$dom->parentNode->removeChild($dom);
|
||||
}
|
||||
if (count($to_delete) > 0) {
|
||||
Config::getInstance()->save();
|
||||
return ['status' => 'deleted'];
|
||||
} else {
|
||||
Config::getInstance()->unlock();
|
||||
return ['status' => 'not found'];
|
||||
}
|
||||
}
|
||||
return ['status' => 'failed'];
|
||||
}
|
||||
|
||||
|
||||
public function rawDumpAction($caref)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user