Updates to SSL and other general items
This commit is contained in:
@@ -39,7 +39,7 @@ class Config extends Kohana_Config {
|
||||
}
|
||||
|
||||
public static function Copywrite($html=FALSE) {
|
||||
return ($html ? '©' : '(c)').' 2014 Deon George';
|
||||
return ($html ? '©' : '(c)').' 2014 IBM';
|
||||
}
|
||||
|
||||
public static function version() {
|
||||
|
@@ -17,6 +17,12 @@ class Controller_User_Welcome extends Controller_Welcome {
|
||||
);
|
||||
|
||||
public function action_index() {
|
||||
Block::factory()
|
||||
->title('Quick Shortcuts')
|
||||
->title_icon('icon-bookmark')
|
||||
->span(3)
|
||||
->body(View::factory('welcome/user/shortcuts'));
|
||||
|
||||
$n = ORM::factory('ADMIN')->where('EMAIL_ADDRESS','=',$this->ao->email)->find_all();
|
||||
if (! $n->count())
|
||||
$output = 'You have no currently registered ADMINs, would you like to '.HTML::anchor(URL::link('user','admin/add'),'Register').' one?';
|
||||
@@ -84,14 +90,6 @@ class Controller_User_Welcome extends Controller_Welcome {
|
||||
->title_icon('icon-info-sign')
|
||||
->span(9)
|
||||
->body($output);
|
||||
|
||||
/*
|
||||
Block::factory()
|
||||
->title('Quick Shortcuts')
|
||||
->title_icon('icon-bookmark')
|
||||
->span(3)
|
||||
->body(View::factory('welcome/user/shortcuts'));
|
||||
*/
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
72
application/classes/Kohana.php
Normal file
72
application/classes/Kohana.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class overrides Kohana's Core
|
||||
*
|
||||
* @package Membership Database
|
||||
* @category Modifications
|
||||
* @author Deon George
|
||||
* @copyright (c) 2014 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
abstract class Kohana extends Kohana_Core {
|
||||
/**
|
||||
* Work out our Class Name as per Kohana's standards
|
||||
*/
|
||||
public static function classname($name) {
|
||||
return str_replace(' ','_',ucwords(strtolower(str_replace('_',' ',$name))));
|
||||
}
|
||||
|
||||
/**
|
||||
* Find files using a multi-site enabled application
|
||||
*
|
||||
* In order of precedence, we'll return:
|
||||
* 1) site-theme file, ie: site/X/THEME/${file}
|
||||
* 2) site file, ie: site/X/${file}
|
||||
* 3) theme file, ie: THEME/${file}
|
||||
* 4) normal search, ie: ${file}
|
||||
*/
|
||||
public static function find_file($dir,$file,$ext=NULL,$array=FALSE) {
|
||||
// Limit our scope to the following dirs
|
||||
// @note, we cannot have classes checked, since Config() doesnt exist yet
|
||||
$dirs = array('views','media');
|
||||
|
||||
if (! in_array($dir,$dirs) OR PHP_SAPI === 'cli')
|
||||
return parent::find_file($dir,$file,$ext,$array);
|
||||
|
||||
$prefixes = array('');
|
||||
|
||||
// Our search order.
|
||||
array_unshift($prefixes,Site::Theme().'/');
|
||||
array_unshift($prefixes,sprintf('site/%s/',Site::ID()));
|
||||
array_unshift($prefixes,sprintf('site/%s/%s/',Site::ID(),Site::Theme()));
|
||||
|
||||
foreach ($prefixes as $p)
|
||||
if ($x = parent::find_file($dir,$p.$file,$ext,$array))
|
||||
break;
|
||||
|
||||
// We found a path.
|
||||
return $x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override Kohana's shutdown_handler()
|
||||
*
|
||||
* When set up for multi-site, we need to disable Kohana's caching
|
||||
* unless each site has exactly the same modules enabled.
|
||||
* This is because Kohana::$file is cached with the enabled modules
|
||||
* and is not OSB multi-site aware.
|
||||
*/
|
||||
public static function shutdown_handler() {
|
||||
// If caching isnt enabled, we can skip this anyway
|
||||
if (! Kohana::$caching)
|
||||
return parent::shutdown_handler();
|
||||
|
||||
Kohana::$caching = FALSE;
|
||||
$result = parent::shutdown_handler();
|
||||
Kohana::$caching = TRUE;
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
@@ -20,5 +20,9 @@ class Model_Account extends lnApp_Model_Account {
|
||||
|
||||
return strlen($this->prefix) > 1 ? $this->prefix : sprintf('%s%06d',$this->prefix,$this->id);
|
||||
}
|
||||
|
||||
public function ssl_dn() {
|
||||
return sprintf('O=IBM,CN=%s',$this->id());
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
25
application/classes/Model/SSL.php
Normal file
25
application/classes/Model/SSL.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* SSL Model
|
||||
*
|
||||
* @package TSM Access Management
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2014 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Model_SSL extends lnApp_Model_SSL {
|
||||
public function rules() {
|
||||
return Arr::merge(parent::rules(),array(
|
||||
'csr'=>array(
|
||||
array(array($this,'isValidDN')),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
public function isValidDN() {
|
||||
return ! $this->isCA() AND ($this->account->ssl_dn() == self::_dn(openssl_csr_get_subject($this->csr)));
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user