class Controller_MyStuff extends Controller_Template
public function router($method, $params)
{
if (!logged_in()) {
// Not logged in.
$this->template->title = 'Not logged in';
$this->template->content = View::forge('mycontroller/not_logged_in');
} else {
// Logged in - carry on
return call_user_func_array(array($this, 'action_' . $method), $params);
}
}
...
}
Harro Verton wrote on Tuesday 20th of March 2012:No, this is how it should work.
Edit: checked it out - I like the approach, and have implemented it myself now. Thanks.
For this application I only have one level of user (a user or not a user), so there is no admin logins, which makes things easier. My application links to a CRM and the users exist only on the CRM, or in a Fuel session if logged in - there are not local copies of the user, so I am not able to use any of the off-the-shelf authentication packages for Fuel (they all - without exception - assume that users will exist in the local database, and so all rely on database-oriented models to work). Anyway, that's for another discussion. It looks like you're new here. If you want to get involved, click one of these buttons!