I'm using a controller pluggin with a preDispatch function and ACL and AUTH
logic to determine if the user is required to be logged in and has the
authority to continue as I saw suggested here a while back. My app doesn't
require a 'transitory message' so it is simpler. I provide a text message
area in my signin script to further explain why singin is required, but
enough about me.
Instead of "repeating the same code all over controllers" you can always
create your own login controller class
class My_Controller_Login extends Zend_Controller_Action {}
and then extend from it controllers that require log in.
class ConfidentialController extends My_Controller_Login {}
Jim
Nicolae Namolovan wrote:
>
> In fact I never redirect from a module..
>
> But to cut the code size down and make it more clear.. I do some
> exception.
>
> I have function what check if user is logged or not, if not, it save
> the request_uri where user was trying to go, put a message into
> session to show to user at next page(transitory message), and redirect
> to the login page and halt the exection of current script.
>
> Something like AClass::haltIfNotLogged(); into every init() of
> controllers what need user authentication..
>
> Maybe I should put this functionality into a helper ?
>
> How you would resolve this in a more clean fashion ?
>
> Repeating the same code all over controllers is not really cool..
>
> On Dec 3, 2007 5:32 AM, Peter Lauri <[EMAIL PROTECTED]> wrote:
>> Why don't you redirect from the controller? I'd never redirect from a
>> model. Do a if(MODELCHECK) {redirect } inside of the controller
>> instead. /Peter
>>
>>
>> On Mon, 2007-12-03 at 01:41 +0100, Nicolae Namolovan wrote:
>> > I need a basic url redirect, how can I do that with ZF ?
>> > I'd prefer without any object creation, any static method ?
>> > Looked at the 'Redirector.php', but can't really find any static
>> > function for my purpose...
>> >
>> > A basic task, it seem to me easier just to write my own function, but
>> > don't really want cuz I already have ZF..
>> >
>>
>>
>
>
>
> --
> Sincerely,
> Nicolae Namolovan.
>
>
--
View this message in context:
http://www.nabble.com/Use-the-controller%27s-%24this-%3E_redirect-from-a-model---tf4933838s16154.html#a14130318
Sent from the Zend Framework mailing list archive at Nabble.com.