mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-17 18:14:42 +00:00
System: Trust: Certificates - work in progress for https://github.com/opnsense/core/issues/7248
* prevent certificate removal when used in the configuration * show checkmark in grid when cert is used
This commit is contained in:
parent
9fdb0480b0
commit
b6fccfc232
@ -155,7 +155,7 @@ class CertController extends ApiMutableModelControllerBase
|
||||
};
|
||||
return $this->searchBase(
|
||||
'cert',
|
||||
['descr', 'caref', 'rfc3280_purpose', 'name', 'valid_from', 'valid_to'],
|
||||
['refid', 'descr', 'caref', 'rfc3280_purpose', 'name', 'valid_from', 'valid_to' , 'in_use'],
|
||||
null,
|
||||
$filter_funct
|
||||
);
|
||||
@ -179,7 +179,14 @@ class CertController extends ApiMutableModelControllerBase
|
||||
}
|
||||
public function delAction($uuid)
|
||||
{
|
||||
return $this->delBase('cert', $uuid);
|
||||
if ($this->request->isPost() && !empty($uuid)) {
|
||||
$node = $this->getModel()->getNodeByReference('cert.' . $uuid);
|
||||
if ($node !== null) {
|
||||
$this->checkAndThrowValueInUse((string)$node->refid, false, false);
|
||||
}
|
||||
return $this->delBase('cert', $uuid);
|
||||
}
|
||||
return ['status' => 'failed'];
|
||||
}
|
||||
public function toggleAction($uuid, $enabled = null)
|
||||
{
|
||||
|
||||
@ -113,6 +113,7 @@
|
||||
<csr_payload type="TextField" volatile="true"/>
|
||||
<prv_payload type="TextField" volatile="true"/>
|
||||
<rfc3280_purpose type="TextField" volatile="true"/>
|
||||
<in_use type="BooleanField" volatile="true"/>
|
||||
|
||||
<name type="TextField" volatile="true"/>
|
||||
<valid_from type="TextField" volatile="true"/>
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
|
||||
namespace OPNsense\Trust\FieldTypes;
|
||||
|
||||
use OPNsense\Core\Config;
|
||||
use OPNsense\Base\FieldTypes\ArrayField;
|
||||
use OPNsense\Base\FieldTypes\ContainerField;
|
||||
use OPNsense\Base\FieldTypes\TextField;
|
||||
@ -130,6 +131,10 @@ class CertificatesField extends ArrayField
|
||||
} elseif (!empty((string)$node->crt_payload)) {
|
||||
$node->action = 'manual';
|
||||
}
|
||||
$tmp = Config::getInstance()->object()->xpath("//*[text() = '{$node->refid}']");
|
||||
if (is_array($tmp) && count($tmp) > 1) {
|
||||
$node->in_use = '1';
|
||||
}
|
||||
}
|
||||
return parent::actionPostLoadingEvent();
|
||||
}
|
||||
|
||||
@ -272,6 +272,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
|
||||
<th data-column-id="in_use" data-width="6em" data-type="string" data-formatter="boolean">{{ lang._('In use') }}</th>
|
||||
<th data-column-id="descr" data-width="15em" data-type="string">{{ lang._('Description') }}</th>
|
||||
<th data-column-id="caref" data-width="15em" data-type="string">{{ lang._('Issuer') }}</th>
|
||||
<th data-column-id="rfc3280_purpose" data-width="10em" data-type="string">{{ lang._('Purpose') }}</th>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user