Re: Preventing the execution of beforeFind() on calling an admin function?

2008-01-26 Thread AD7six
On Jan 25, 5:57 pm, powtac <[EMAIL PROTECTED]> wrote: > In the beforeFind() I delete some data of the current user which > should only be in the database for 60 minutes. > But when I want to take a look on the data as admin I dont want to > delete anything... In your model: var $cleanup = true

Re: Preventing the execution of beforeFind() on calling an admin function?

2008-01-25 Thread [EMAIL PROTECTED]
Write wrappers for the find() function in your Library model. function adminFind() { return $this->find(); } fuction userFind() { $this->deleteStuff(); return $this->find(); } On Jan 25, 9:57 am, powtac <[EMAIL PROTECTED]> wrote: > In the beforeFind() I delete some data of the current user whi

Re: Preventing the execution of beforeFind() on calling an admin function?

2008-01-25 Thread powtac
In the beforeFind() I delete some data of the current user which should only be in the database for 60 minutes. But when I want to take a look on the data as admin I dont want to delete anything... --~--~-~--~~~---~--~~ You received this message because you are subs

Re: Preventing the execution of beforeFind() on calling an admin function?

2008-01-25 Thread grigri
> How can I access to the params in model? You can't. You're not supposed to. The params belong to the controller - who processes the user action. Your 'Library' model should not know or care whether the user is an administrator. It just does whatever the controller tells it to, which DOES know

Re: Preventing the execution of beforeFind() on calling an admin function?

2008-01-25 Thread powtac
Hi red, I'm sorry this seems not to be working in the (1.2) model: Undefined property: library::$params How can I access to the params in model? powtac --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" gro

Re: Preventing the execution of beforeFind() on calling an admin function?

2008-01-25 Thread red
Don't know any. But you can still put this 'global' things in global AppController. On 25 Sty, 16:49, powtac <[EMAIL PROTECTED]> wrote: > Great! Thanks. > > Is there an other more global solution to prevent before*() after*() > functions to be executed? --~--~-~--~~~-

Re: Preventing the execution of beforeFind() on calling an admin function?

2008-01-25 Thread red
Try this: function beforeFilter() { if (isset($this->params[Configure::read('Routing.admin')])) { // things for admins } else { // things for not admins } } On 25 Sty, 16:39, powtac <

Re: Preventing the execution of beforeFind() on calling an admin function?

2008-01-25 Thread powtac
Great! Thanks. Is there an other more global solution to prevent before*() after*() functions to be executed? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cak

Preventing the execution of beforeFind() on calling an admin function?

2008-01-25 Thread powtac
How can I avoid the execution of any before*() function in the modell when calling an admin function in ancontroller? Example: http://www.example.com/admin/libraries/ In my Libraries-controller I have a function named admin_index(). Now the beforeFind() in my model "Library" is called. But I on