Minor fixes to ssl and core
This commit is contained in:
@@ -41,15 +41,12 @@ class Controller_Admin_SSL extends Controller_TemplateDefault_Admin {
|
||||
$so = ORM::factory('ssl_ca',$id);
|
||||
|
||||
if ($_POST) {
|
||||
if (! $so->values($_POST)->check() OR ! $so->save())
|
||||
throw new Kohana_Exception('Failed to save updates to data for record :record',array(':record'=>$so->id()));
|
||||
else {
|
||||
if ($so->values($_POST)->check() AND $so->save())
|
||||
SystemMessage::add(array(
|
||||
'title'=>'SSL Certificate Saved',
|
||||
'type'=>'info',
|
||||
'body'=>'SSL Certificate successfully recorded.',
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$output .= Form::open();
|
||||
|
@@ -34,7 +34,36 @@ class Model_SSL_CA extends ORMOSB {
|
||||
return SSL::issuer($this->sign_cert);
|
||||
}
|
||||
|
||||
public function subject() {
|
||||
return SSL::subject($this->sign_cert);
|
||||
}
|
||||
|
||||
// @todo SAVE: auto work out the parent_ssl_ca_id
|
||||
public function save(Validation $validation = NULL) {
|
||||
// If our parent_ssl_ca_id is null, we'll need to work it out
|
||||
if (is_null($this->parent_ssl_ca_id)) {
|
||||
$i = SSL::issuer($this->sign_cert);
|
||||
|
||||
$po = NULL;
|
||||
foreach (ORM::factory('ssl_ca')->find_all() as $sco)
|
||||
if ($sco->subject() == $i) {
|
||||
$po = $sco;
|
||||
break;
|
||||
}
|
||||
|
||||
if (is_null($po)) {
|
||||
SystemMessage::add(array(
|
||||
'title'=>'Certificate NOT Recorded',
|
||||
'type'=>'warning',
|
||||
'body'=>sprintf('Parent Certificate is not available (%s)',$this->issuer()),
|
||||
));
|
||||
|
||||
return FALSE;
|
||||
} else
|
||||
$this->parent_ssl_ca_id = $po->id;
|
||||
}
|
||||
|
||||
// Save the record
|
||||
return parent::save($validation);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user