Added SSL

This commit is contained in:
Deon George
2014-10-08 23:17:00 +11:00
parent 62992c1a0e
commit c952738750
17 changed files with 1411 additions and 11 deletions

View File

@@ -12,6 +12,10 @@
class Controller_User_Welcome extends Controller_Welcome {
protected $auth_required = TRUE;
protected $secure_actions = array(
'index'=>0,
);
public function action_index() {
$n = ORM::factory('ADMIN')->where('EMAIL_ADDRESS','=',$this->ao->email)->find_all();
if (! $n->count())
@@ -31,7 +35,29 @@ class Controller_User_Welcome extends Controller_Welcome {
));
Block::factory()
->title(sprintf('Your ADMINs in TSMs : %s',$this->ao->name()))
->title(sprintf('Your ADMINs in TSM : %s',$this->ao->name()))
->title_icon('icon-info-sign')
->span(9)
->body($output);
$n = $this->ao->ssl->find_all();
if (! $n->count())
$output = 'You have no currently SSL Certificates, would you like to '.HTML::anchor(URL::link('user','ssl/add'),'add').' one?';
else
$output = Table::factory()
->data($n)
->columns(array(
'id'=>'ID',
'dn()'=>'Cert',
'valid_to(TRUE)'=>'Expires',
'issuer_cn()'=>'Issuer',
))
->prepend(array(
'id'=>array('url'=>URL::link('user','ssl/view/')),
));
Block::factory()
->title(sprintf('Your SSL Certificates for TSM : %s',$this->ao->name()))
->title_icon('icon-info-sign')
->span(9)
->body($output);
@@ -54,7 +80,7 @@ class Controller_User_Welcome extends Controller_Welcome {
));
Block::factory()
->title(sprintf('Your NODES in TSMs : %s',$this->ao->name()))
->title(sprintf('Your NODES in TSM : %s',$this->ao->name()))
->title_icon('icon-info-sign')
->span(9)
->body($output);

View File

@@ -0,0 +1,24 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* Acconunt Model
*
* @package TSM Access Management
* @category Models
* @author Deon George
* @copyright (c) 2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
class Model_Account extends lnApp_Model_Account {
protected $_has_many = array(
'ssl'=>array('model'=>'SSL','far_key'=>'id','foreign_key'=>'account_id'),
);
public function id() {
if (! $this->prefix)
throw HTTP_Exception::factory(501,'Your prefix is missing, please contact an admin');
return strlen($this->prefix) > 1 ? $this->prefix : sprintf('%s%06d',$this->prefix,$this->id);
}
}
?>

View File

@@ -0,0 +1,34 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class overrides Kohana's ORM
*
* This file contains enhancements for Kohana, that should be considered upstream and maybe havent been yet.
* It also contains some functionality for OSB, which cannot be covered in ORM_OSB.
*
* @package TSM Access Management
* @category Modifications
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
abstract class ORM extends lnApp_ORM {
/**
* Function help to find records that are active
*/
protected function _where_active() {
return $this->where('status','=',TRUE);
}
/**
* Function help to find records that are active
*/
public function list_active() {
return $this->_where_active()->find_all();
}
public function where_active() {
return $this->_where_active();
}
}
?>