On 04.09.2007, at 12:08, Sam Barnum wrote:
Certain entities are "global", meaning shared among all clients. A
good example would be a table containing status names for jobs.
This is the same for all clients.
Are you sure about that? I have the experience that some clients want
more or less entries in these tables, therefor such tables get set up
per client in my app. You can automate that on the client entity to
create the entries.
Now the tricky part. I'd like to automate this filtering, so I
don't have to explicitly qualify "client=A" for every fetch against
Projects I do. Ideally, a user can use a D2W interface to do a
search for projects beginning with "P", and it will only return
results for his client.
I use a modified D2W list page [1], where I specify an restricting
qualifier. This list page adds a qualifier based on two rules to the
list qualifier:
task = 'list' => restrictingObjectKey = 'client' [80]
task = 'list' => restrictingObject = session.currentClient [80]
I have more rules to exclude some entities from that, but it works
nice. In combination I have on all entities, that are not global a
check in awakeFromFetch that the client for this object and the
current client in the session are the same - if not it throws an
exception.
Also I have modified my EOGenericRecord superclass to set the
"client", the "createdBy" and the "creationTime" automatically. I do
this by checking whether these attribute keys are available and get
the information from the ERXThreadStorage, where it is put during
Session.awake().
There is some more magic going on, but it works very well here.
Ah, and I use Wonder for all my own projects ...
cug
[1] You can get it here: http://code.google.com/p/evdirecttoweb/
Be warned that this project is YOUNG and has more non-working
than working components!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]