as versões são as seguintes:
cakephp: 1.1.18.5850;
othAuth: 0.5.
--------------------------------------
app_controller:
------------------------------------------------
class AppController extends Controller {
var $components = array('othAuth'); // necessary, we need to have the
othauth component so it can do it's business logic
var $helpers = array('Html', 'OthAuth',
'Form','Ajax','Javascript','Menu'); // html is always needed, othauth
helper is not a must, but you can do some cool things with it (see
later on)
var $othAuthRestrictions =
array( 'view','index','add','edit','delete'); // these are the global
restrictions, they are very important. all the permissions defined
above
function beforeFilter()
{
$auth_conf = array(
'mode' => 'oth',
'login_page' => '/users/login',
'logout_page' => '/users/logout',
'access_page' => '/circuits/index',
'hashkey' => 'MySEcEeTHaSHKeYz',
'noaccess_page' => '/users/noaccess',
'strict_gid_check' => false);
$this->othAuth->controller = &$this;
$this->othAuth->init($auth_conf);
$this->othAuth->check();
}
}
---------------------------
users controller
-------------------------------------------
class UsersController extends AppController {
var $name = 'Users';
function login()
{
if(isset($this->params['data']))
{
$auth_num = $this->othAuth->login($this->params['data']
['User']);
$this->set('auth_msg', $this->othAuth->getMsg($auth_num));
}
}
function logout()
{
$this->othAuth->logout();
$this->flash('You are now logged out!','/users/login');
}
function noaccess()
{
$this->flash("You don't have permissions to access this page.",'/
users/login');
}
}
--~--~---------~--~----~------------~-------~--~----~
Recebeu esta mensagem porque está inscrito em Grupo "Cake PHP Português" do
Grupos Google.
Para enviar mensagens para este grupo, envie um email para
[email protected]
Para anular a inscrição neste grupo, envie um email para [EMAIL PROTECTED]
Para mais opções, visite este grupo em
http://groups.google.com/group/cake-php-pt?hl=pt-PT
-~----------~----~----~----~------~----~------~--~---