Hi Stalemate,

_caveat_ code is pseudo code, and it's just my thoughts ;)

Routes allow you to specify how the url is interpreted, it isn't a
workflow mechanism and won't help much in the "after this do that" type
logic.

Re beforeScaffold

http://api.cakephp.org/controller_8php-source.html#l00852

adding an extra step wouldn't solve the fact that accessing your url
directly would bypass your authentication - sure you thought of that. I
don't think scaffolding is appropriate for an admin page, it's an
extremely quick means of getting going. You could chose to create a
scaffolded controller and then add/override each of the methods as you
go (if you define the index method for example, your code is run and
not the scaffolded version, but the scaffold for add/show/delete still
function). Creating a controller and the views for CRUD actions is
quite easy with the bake script (I don't use it but that's what I hear
:) ) or just writing them manually.

But anyway, the method may be used like this (I think)>

    function _beforeScaffold($method)
    {
                if ($this->ACL->check())
                {
                        return true;
                }
                else
                {
                        $this->redirect ("/not/logged/in/or/not/allowed");
                        die;
                }
  }

That said, I think it would be more interesting for your to investigate
the built in cake admin routes, and create a before filter such as
this:
  function beforeFilter()
  {
        if (isset($this->params['admin'])) // true for admin methods
        {
                if (($this->ACL->check())
                {
                        return true; // Access granted to admin methods
                }
                else
                {
                        $this->redirect ("/not/logged/in/or/not/allowed");
                        die;
                }
        }
        return true;
  }

I do hope that's helpful, and you may find that the irc channel (you
can access it here too> http://irc.cakephp.org/) provides quicker and
more specifc answers.

Cheers 4 now,

AD7six


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to