On 4-Sep-07, at 2:45 PM, Guido Neitzer wrote:

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 stole Guido's code :-) and extended it so I can pass in a custom EOQualifier as well for those time when I need to get fancy (item isActive AND item belongs to Phil)

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().

I do this too, though I conditionally generate the awakeFromInsetion and willUpdate code in my EOGenrator templates instead of in a superclass.

;david

--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site:   http://codeferous.com
blog: http://davidleber.net
profile: http://www.linkedin.com/in/davidleber
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to