Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at
H:\www_root\zakazky\ishop\app\controllers\components\oth_auth.php:1450)
in H:\www_root\zakazky\ishop\cake\libs\session.php on line 146
Warning: Cannot modify header information - headers already sent by
(output started at
H:\www_root\zakazky\ishop\app\controllers\components\oth_auth.php:1450)
in H:\www_root\zakazky\ishop\cake\libs\session.php on line 147
Warning: Cannot modify header information - headers already sent by
(output started at
H:\www_root\zakazky\ishop\app\controllers\components\oth_auth.php:1450)
in H:\www_root\zakazky\ishop\cake\libs\controller\controller.php on
line 441
------------------------
There are controller:
---------------------------
APP C.
<?php
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', 'Javascript'); // html is
always needed, othauth helper is not a must, but you can do some cool
things with it (see later on)
var $othAuthRestrictions = CAKE_ADMIN; // these are the global
restrictions, they are very important. all the permissions defined
above
function beforeFilter()
{
$auth_conf = array(
'mode' => 'oth',
'login_page' => '/admin/login',
'logout_page' => '/admin/logout',
'access_page' => '/admin/index',
'hashkey' => 'MySEcEeTHaSHKeYz',
'noaccess_page' => '/admin/noaccess',
'strict_gid_check' => false);
$this->othAuth->controller = &$this;
$this->othAuth->init($auth_conf);
$this->othAuth->check();
}
}
?>
--------------
Users Controller:
<?php
class UsersController extends AppController {
var $name = 'Users';
var $helpers = array('Html', 'Form');
var $components = array('Mysql');
function admin_index(){
$this->User->recursive = 0;
$this->set('users', $this->User->findAll());
}
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.",'/admin/login');
}
}
?>
-------------
Models i have as in <?php
class UsersController extends AppController {
var $name = 'Users';
var $helpers = array('Html', 'Form');
var $components = array('Mysql');
function admin_index(){
$this->User->recursive = 0;
$this->set('users', $this->User->findAll());
}
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.",'/admin/login');
}
}
?>
------------------
SQL:
----------------
INSERT INTO `groups` (`id`, `name`, `level`, `redirect`, `perm_type`,
`created`, `modified`) VALUES
(1, 'webmasters', 100, '', 'allow', '0000-00-00 00:00:00', '0000-00-00
00:00:00'),
(2, 'editors', 200, '', 'allow', '0000-00-00 00:00:00', '0000-00-00
00:00:00'),
(3, 'members', 300, '', 'allow', '0000-00-00 00:00:00', '0000-00-00
00:00:00');
--
-- Vypisuji data pro tabulku `groups_permissions`
--
INSERT INTO `groups_permissions` (`group_id`, `permission_id`) VALUES
(1, 1),
(2, 2),
(2, 3),
(3, 4),
(3, 5);
--
-- Vypisuji data pro tabulku `permissions`
--
INSERT INTO `permissions` (`id`, `name`, `created`, `modified`) VALUES
(1, '*', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(2, 'news', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(3, 'userprofiles', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(4, 'userprofiles/view', '0000-00-00 00:00:00', '0000-00-00 00:00:00'),
(5, 'userprofiles/add', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
--
-- Vypisuji data pro tabulku `users`
--
INSERT INTO `users` (`id`, `username`, `passwd`, `name`, `email`,
`last_visit`, `group_id`, `active`, `created`, `modified`) VALUES
(1, 'lova', 'a2f2d1fb39a9190ef6fb5a9019092878', 'Petr Vytla il',
'[EMAIL PROTECTED]', '0000-00-00 00:00:00', 1, 1, '2007-01-16
00:21:30', '2007-01-16 00:21:30');
----
othAuth component i have from http://bakery.cakephp.org/articles/view/99
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---