Re: limiting All Queries in D2W
Re: limiting All Queries in D2W
- Subject: Re: limiting All Queries in D2W
- From: Fabian Peters <email@hidden>
- Date: Fri, 13 Apr 2012 13:27:17 +0000
Am 13.04.2012 um 11:34 schrieb Theodore Petrosky:
> I don't even know where to begin. I have a D2W app that manages Briefs. A Brief is created by a User. (one to one relation)
>
> I can easily create a tab that calls a method to limit the resultant list to only those Briefs created by the current User. However, where do I 'fix' the search area.
>
> I mean if the current User is Sally, she will search for Brief(s) that the Objective attribute contains the word 'Iceman'. But I want all queries to include 'and user = 'Sally'.
You can add restricting qualifiers (almost) globally via "editingContextShouldFetchObjects" in ERXEditingContextDelegate. Just create your own EC delegate and use it to modify the fetch spec. To define your custom delegate as the default delegate:
new ERXEC.DefaultFactory()
.setDefaultEditingContextDelegate(new DREditingContextDelegate());
> Sally should not see Bob's Briefs. I am trying to embrace D2W, and (for me) this would be trivial in a Wonder app.
For D2W you can subclass EODatabaseDataSource and modify the constructors and the "setFetchSpecification" method to ensure restrictions are applied. To make sure your subclass gets used you can implement "ERDQueryDataSourceDelegateInterface" and set it via the rules. Using only the queryDataSourceDelegate may also be sufficient depending on your needs.
cheers, Fabian
> Is there a property for this?
>
> Ted
> _______________________________________________
> 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
_______________________________________________
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