You could set up event types based on the roles.

<event-handler name="Something.Happens" type="requireAtLeastAdmin">

<event-handler name="Something.Happens" type="requireAtLeastAuthenticated">




DW

On Thu, Jul 16, 2009 at 11:19 AM, Jeremy Prevost <[email protected]> wrote:

>
> Thanks for the replies.
>
> My use case is to have required security roles defined in the same
> place as the events are defined rather than duplicating the event
> names in some security centric config file. I currently use event name
> prefixes, which works okay (admin.doStuff requires the admin role;
> staff.viewThing requires the staff role etc). I just thought using
> typed events (and somehow passing the required role in) would be more
> flexible down the road (i.e. changing event names to change the
> required role sucks).
>
>
> On Jul 16, 7:35 am, Jared Rypka-Hauer <[email protected]> wrote:
> > Right, but what he's saying is that with the advent of typed events it
> > may be important or at least advantageous to be able to pass a
> > parameter from the config to the event onject based on type.
> >
> > Dan:
> > Message arguments may look like the same thing, and even put the value
> > in the same place, but their motivational forces are entirely
> > different. Having to pass the same argument to every message defeats
> > the purpose of typed events in the first place, at least to an extent.
> >
> > Doug:
> > So how do you propose yo get the event value from your brain into the
> > event object one a one-per-event basis? Creating a special message
> > handler (<message name="setRequiredRole"><argument name="role"
> > value="admin" /> <message/>) might work but it smells strongly of HACK
> > to me...
> >
> > Sent from my iPhone
> >
> > On Jul 16, 2009, at 7:12 AM, Doug Hughes <[email protected]> wrote:
> >
> >
> >
> > > "Thus, there isn't currently a mechanism to pass an argument to an
> > > event-handler as far as I know."
> >
> > > Sure there is: event values. :)
> >
> > > Doug Hughes, President
> > > Alagad Inc.
> > > [email protected]
> > > 888 Alagad4 (x300)
> > > Office: 919-550-0755
> > > Fax: 888-248-7836
> >
> > > On Wed, Jul 15, 2009 at 10:49 PM, Dan Wilson <[email protected]>
> > > wrote:
> > > Arguments are child tags of Message tags.
> >
> > > For example:
> >
> > > <event-handler name="page.index" type="SecuredEvent">
> > >    <broadcasts>
> > >       <message name="NeedStuff">
> >
> > >          <argument name="requiredRole" value="admin" /> <!-- This is
> > > the
> > >                    role I want to pass to my secured event -->
> > >       </message>
> >
> > >    </broadcasts>
> > >    <results>
> > >     <result do="view.templateSideNav" />
> > >    </results>
> > >    <views>
> > >      <include name="body" template="dspIndexSideNav.cfm" />
> > >    </views>
> > > </event-handler>
> >
> > > Thus, there isn't currently a mechanism to pass an argument to an
> > > event-handler as far as I know.
> >
> > > DW
> >
> > > On Wed, Jul 15, 2009 at 5:54 PM, Jeremy Prevost <[email protected]>
> > > wrote:
> >
> > > Hi!
> >
> > > I'm trying to use an EventType to secure my events. I'm not having any
> > > trouble getting my "SecuredEvent" to trigger before the rest of my
> > > broadcast. However, what I am having trouble with is passing an
> > > argument into the SecuredEvent. In short, I want to pass in a required
> > > role, but define it in my event config.
> >
> > > Here's the type of thing I'm trying to do, but it doesn't work.
> >
> > > <event-handler name="page.index" type="SecuredEvent">
> > >    <argument name="requiredRole" value="admin" /> <!-- This is the
> > > role I want to pass to my secured event -->
> > >    <broadcasts>
> > >       <message name="NeedStuff" />
> > >    </broadcasts>
> > >    <results>
> > >     <result do="view.templateSideNav" />
> > >    </results>
> > >    <views>
> > >      <include name="body" template="dspIndexSideNav.cfm" />
> > >    </views>
> > > </event-handler>
> >
> > > Is this not supported, or am I just having a syntax problem?
> >
> > > Thanks,
> > > Jeremy
> >
> > > --
> > > “Come to the edge, he said. They said: We are afraid. Come to the ed
> > > ge, he said. They came. He pushed them and they flew.”
> >
> > > Guillaume Apollinaire quotes
> >
>


-- 
“Come to the edge, he said. They said: We are afraid. Come to the edge, he
said. They came. He pushed them and they flew.”

Guillaume Apollinaire quotes

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "model-glue" 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/model-glue?hl=en

For more about Model-Glue, check http://www.model-glue.com .
-~----------~----~----~----~------~----~------~--~---

Reply via email to