Re: strange behavior when action is Auth-allow(ed)

2011-05-06 Thread Ryan Schmidt

On May 5, 2011, at 15:16, Mariano C. wrote:

 function beforeFilter()
 {
parent::beforeFilter();
$this-Auth-allow(array('showTables'));
 }
 
 
 
 When i call http://./showTables/season_id:1 for the first time I
 will be redirect to the login page. Now if I rewrite 
 http://./showTables/season_id:1
 for the second time the action will be showed (without insert user and
 password).

Check the documentation. $this-Auth-allow() does not accept an array.

http://book.cakephp.org/view/1257/allow



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: strange behavior when action is Auth-allow(ed)

2011-05-06 Thread Mariano C.
On 6 Mag, 08:19, Ryan Schmidt google-2...@ryandesign.com wrote:
 On May 5, 2011, at 15:16, Mariano C. wrote:

  function beforeFilter()
  {
         parent::beforeFilter();
         $this-Auth-allow(array('showTables'));
  }

  When i callhttp://./showTables/season_id:1for the first time I
  will be redirect to the login page. Now if I 
  rewritehttp://./showTables/season_id:1
  for the second time the action will be showed (without insert user and
  password).

 Check the documentation. $this-Auth-allow() does not accept an array.

 http://book.cakephp.org/view/1257/allow

Removed the array notation, but problem still persist.
Why system need to take CAKEPHP named cookie?
How can avoid it?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


strange behavior when action is Auth-allow(ed)

2011-05-05 Thread Mariano C.
I've followed your guide to auth: 
http://book.cakephp.org/view/1250/Authentication
This is my app_controller.php:

class AppController extends Controller {
var $components = array('DebugKit.Toolbar', 'Session', 'Auth');
var $helpers = array('Html','Javascript',  'Session', 'Ajax',
'Facebook.Facebook');

function beforeFilter()
{
// importa modello Season
$this-Season = ClassRegistry::init('Season');

// ricava la variabile di sessione
$id = $this-Session-read('editable_season_id');

// verifica se tale id è esistente
$exist = $this-Season-exist($id);

// se non esiste o è un valore non valido o è nullo
if((is_null($id)) || (!is_numeric($id) || (!$exist)))
{
// cerca l'id della stagione più recente
$id = $this-Season-getLastSeasonId();

// se esiste assegnalo ad una var di sessione
if($id)
{
$this-Session-write(editable_season_id, $id);
$title = $this-Season-getSeasonName($id);
$this-Session-write(editable_season_title,
$title);
$this-redirect($this-referer());
} else { // altrimenti lancia errore
$seasons = $this-Season-getSeasons();
$this-cakeError('defaultSesonNotFound',
array('seasons' = $seasons));
}
}
 }
}

It works correctly. Now if inside a controller there's an action and i
want to make it public i override beforeFilter method:
function beforeFilter()
{
parent::beforeFilter();
$this-Auth-allow(array('showTables'));
}



When i call http://./showTables/season_id:1 for the first time I
will be redirect to the login page. Now if I rewrite 
http://./showTables/season_id:1
for the second time the action will be showed (without insert user and
password).

Why this strange behavior?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php