But I must generate a PDF file to attach to the email.
The PDF file is generated with the HTML2PDF library.
So in my action, I use the method:
$myPDF = $this->getPresentationFor('myModule', 'myAction');
And this method must be secured.
Sébastien Cas
De : [email protected] [mailto:[EMAIL PROTECTED]
De la part de Piers Warmers
Envoyé : lundi 10 septembre 2007 10:58
À : [email protected]
Objet : [symfony-users] Re: Batch and secured action
Hi Sebastien,
So I guess what you want to do is have a method which is triggered via
multiple sources.
So for instance:
function sendOutMail()
{
// Sends out a mass email to all people in my database
}
.... might be triggered via an action responding to a http request, or
alternatively a cron job.
What I guess is causing you issues, is the fact you are not sectioning off
your logic into an easily usable manner.
First thing to remember is that if you call your script via the command
line, no session will be created, thus no access to things like credentials.
but that shouldn't be a problem if you have correctly abstracted your logic.
So what you might want to do is have an action:
executeSendMail()
{
// Check Credentials
// Trigger send of mail
MyMailClass::sendOutMail();
}
By doing this, you separate the logic which services a request, to that
which service the target function.
Then in your batch script, you can directly access the method sendOutMail(),
rather than trying to access the action.
Hope this helps.
Piers
On 10/09/2007, at 7:35 PM, Sébastien CAS wrote:
Hi all,
I've created a batch file to send daily emails to my users.
So I call an action in my batch file like that:
sfContext::getInstance()->getController()->forward('myModule', 'myAction');
But this action is secured and requires "admin" credential.
So:
sfContext::getInstance()->getUser()->setAuthenticated(true);
sfContext::getInstance()->getUser()->addCredential('admin');
But the credential 'admin' is not applied and I have not the permissions to
access this action.
How to call an action which is secured in a batch file?
Sébastien Cas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" 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/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---