On Feb 28, 2013, at 8:53 AM, Ramsey Gurley < email@hidden> wrote: On Feb 27, 2013, at 5:46 PM, David Avendasora wrote: On Feb 28, 2013, at 8:35 AM, Ramsey Gurley < email@hidden> wrote: On Feb 27, 2013, at 5:07 PM, David Avendasora wrote: On Feb 28, 2013, at 3:00 AM, Ramsey Gurley < email@hidden> wrote: I've looked at a couple ways, but I'm not sure what is the best strategy. I'm thinking creating a custom D2W Assignment subclass is the way, but I'm not sure.
If you aren't storing them, you can probably come up with a decent solution using a single assignment. It would just need some sort of permission manager object to consult. Maybe that comes from the rules or maybe a thread local.
What I was thinking of is something similar to the QueryDatasourceDelegate where you could define a delegate class that would have the logic to filter the array of displayPropertyKeys prior to them being returned by the D2WContext.
Simply create a rule that defines what delegate it should use to filter the displayPropertyKeys prior to returning them. The logic of why or how to filter is entirely up to the developer - it could be based on user preference or permissions triggering it would be controlled by the rule system.
Dave
What you've described actually exists! It's called an Assignment ;-)
Ramsey
Okay, maybe I'm missing a fundamental concept (no shocker there). So how do I tell it to go use the delegate instead of providing a list of keys manually in a rule?
Dave
With a rule, of course :-)
100: *true* => displayPropertyKeys = "" [DavesAssignment]
Notice there's no value on the rule. There could be, but there doesn't have to be. And now all your displayPropertyKeys everywhere will be set by DavesAssignment.
Ramsey
Ah! Okay, so it's one of the options I was considering waaaaaay back in the first message in the thread; that I should create a new Assignment subclass.
However, I think I'd still pass in the default list of keys that my assignment subclass could then filter based on any delegates it finds.
Thanks!
—————————————————————————————
WebObjects - so easy that even Dave Avendasora can do it!™ ————————————————————————————— David Avendasora Senior Software Abuser Kaiten, Inc.
|