On Feb 26, 2013, at 10:10 PM, David Avendasora wrote: Hi all you D2W devs out there!
Your worst nightmare is here, and I'm using D2W for a app about to go into production!
Run for the hills! =8-0 After it's initial roll-out, one of the next features to be rolled out is to vary the attributes and relationships displayed to users based on permissions that they have.
What I'd like to do is take the keys that are defined by displayPropertyKeys in the rule file and then filter it based on which ones they have permissions to.
I do something similar in R2, but at the repetitions. There's a displayProperty rule which can optionally omit a property key entirely. I tie that to my ERAuth stuff so that if you aren't authorized to read a field on an inspect page, it just isn't there.
In the case of something like a list repetition, I just swap out the property level component with an ERXEmptyComponent (or some other "Not authorized" component) since the user may have rights to see a property on one row, but no rights on the next.
I have figured out a way to define and later recall which keys each users has permissions to view and/or edit, now I just need a mechanism to filter the rule-defined keys based on the currently-loggedin user's permissions.
I've long considered making displayPropertyKeys a delayed assignment that comes out of the userPreferences dictionary. I've just never had enough time or desire to implement it yet.
What I want to do is create a new rule for availablePropertyKeys which will be determined by a custom assignment and the users permission level. I would need to include a defaultPropertyKeys array to allow the default to be set if I didn't want to default to all the available property keys for some reason. This is probably the easy part.
Like the userPreferences for sortOrderings, it would need to have some built in way to validate the keys since keys on the model objects and user permissions can change over time. This is a bit harder since a key may be a key path, and the path may include all sorts of fun stuff like method names, @keys, rule system keys, etc.
Anyway, on each D2WPage, I would have a component which would allow the user to select the properties they would like to display from the available keys list. That way, the user is given some control of what they want to see. Of course, once they have control over what is visible, they'll want control over the order of the keys too. Doing this without _javascript_ may be the trickiest part :P
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.
Ramsey Any suggestions? Thanks! Dave
—————————————————————————————
WebObjects - so easy that even Dave Avendasora can do it!™ ————————————————————————————— David Avendasora Senior Software Abuser Kaiten, Inc.
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
|