From http://www.symfony-project.com/book/1_0/06-Inside-the-Controller-Layer

Module Configuration

A few module behaviors rely on configuration. To modify them, you must 
create a module.yml file in the module's config/ directory and define 
settings on a per-environment basis (or under the all: header for all 
environments). Listing 6-38 shows an example of a module.yml file for 
the mymodule module.

Listing 6-38 - Module Configuration, in 
apps/myapp/modules/mymodule/config/module.yml

all:                 # For all environments
  enabled:     true
  is_internal: false
  view_name:   sfPHP

The enabled parameter allows you to disable all actions of a module. All 
actions are redirected to the 
module_disabled_module/module_disabled_action action (as defined in 
settings.yml).

The is_internal parameter allows you to restrict the execution of all 
actions of a module to internal calls. For example, this is useful for 
mail actions that you must be able to call from another action, to send 
an e-mail message, but not from the outside.

The view_name parameter defines the view class. It must inherit from 
sfView. Overriding this value allows you to use other view systems, with 
other templating engines, such as Smarty.

Kupo

Sébastien CAS wrote:
>
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to