call a controller's action from shell as an authorized user

View: New views
2 Messages — Rating Filter:   Alert me  

call a controller's action from shell as an authorized user

by rrd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hari,

My service http://sociall.cc sends and receivesmessages from and to
more social networks like twitter, facebook, etc. I would like to add
a timed messages service where users could set messages to send in a
future time.

For this I need to have my own cake shell and run it by a crontask.

At a certain point I want to call

$this->requestAction('/messages/send');

But messages controller's send action is available if there is an
authenticated user.

So before I call this somehow the shell should authenticated itself as
a user. Than it could send the message, and the shell could
reauthenticate itself as a different user and send messages belongs to
that user.

The question is how could I authenticate the shell as a particular
user?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@...
To unsubscribe from this group, send email to cake-php+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: call a controller's action from shell as an authorized user

by rrd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Finaly I got the answer on irc.

class TimedShell extends Shell{

function main(){
App::import('Component','Auth');
$this->Auth = new AuthComponent(null);
App::import('Component','Session');
$this->Auth->Session = new SessionComponent(null);
...
}

--

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@....
To unsubscribe from this group, send email to cake-php+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/cake-php?hl=.