Created
May 10, 2012 04:56
-
-
Save rjmackay/2651105 to your computer and use it in GitHub Desktop.
Ushahidi MY_Controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('SYSPATH') or die('No direct script access.'); | |
/** | |
* Base Controller | |
* Enforces basic access control, ie. for private deployments | |
* | |
* PHP version 5 | |
* LICENSE: This source file is subject to LGPL license | |
* that is available through the world-wide-web at the following URI: | |
* http://www.gnu.org/copyleft/lesser.html | |
* | |
* @author Ushahidi Team <[email protected]> | |
* @package Ushahidi - http://source.ushahididev.com | |
* @subpackage Controllers | |
* @copyright Ushahidi - http://www.ushahidi.com | |
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL) | |
*/ | |
abstract class Controller extends Controller_Core { | |
public function __construct() | |
{ | |
parent::__construct(); | |
$this->auth = new Auth(); | |
if (! $this->auth->logged_id()) { | |
$this->auth->auto_login(); | |
} | |
$controller_whitelist = array( | |
'login', | |
'riverid' | |
); | |
if (Kohana::config('settings.private_deployment')) | |
{ | |
if (!$this->auth->logged_in('login') AND ! in_array(Router::$controller, $controller_whitelist)) | |
{ | |
url::redirect('login'); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment