I think the answer may be to manually insert the request_tenant field where I want it.
I really only want it in the tables that represent objects, not in the many-to-many linking tables. Thanks, Richard. I got it working. The table structure is really pretty simple. It's lifted from a working PHP app that I currently have in production. I'm using the generic user_auth table with a few fields added for middle names, generation indicators and so on. The training_requirements table is a simple linking table. On Jul 25, 2:01 pm, Richard Vézina <[email protected]> wrote: > Could you post your models... > > You can make view at DB level and define a web2py model of your view... It > help to get things done sometime and you can come back later and build > web2py query correctly. > > Richard > > > > > > > > On Mon, Jul 25, 2011 at 1:45 PM, Cliff <[email protected]> wrote: > > Found it, but don't know what to do about it. > > > Here is what the DAL is spitting out: > > > SELECT auth_user.first_name, training_requirements.course_id FROM > > auth_user LEFT JOIN training_requirements ON > > (training_requirements.user_id = auth_user.id) WHERE > > (((training_requirements.course_id = 8) OR > > (training_requirements.course_id IS NULL)) AND > > (training_requirements.request_tenant = '1')); > > > The tail end of the query should be like this: > > AND((training_requirements.request_tenant = '1') | > > (training_requirements.request_tenant IS NULL)) > > > What I really want to do is check the auth_user entries against the > > request tenant. Training_requirements is just a link table and I > > don't really see a need to protect those records since the objects on > > both ends of the link get protection. > > > I really don't want to start writing native SQL to work around this.

