[Zope] UserDb

Rob Page rob.page@digicool.com
Wed, 10 Feb 1999 16:09:43 -0500


This answer from one of the dumber Zopesters at DC...  caveat emptor...

>  In particular, I like the ability to validate against my db. However,
>  I'm wondering if there's some clever method of overriding the SQL
>  methods used by UserDb, short of 'cut&paste' code reuse to make
>  myUserDb. See, I've already got tables & fields with usernames and
>  passwords, but I need different queries to access them. Ideally, I'd
>  like to overide a particular _instances_ methods - so, for example, I
>  can have users in different Teams, and return only the users 
>  that exist
>  in a particular team. Any bright ideas out there? Is this another
>  something obvious that I failed to grasp, any you're all now 
>  laughing at
>  me?

<untested>
What about:

/top/UserDB
    /Team1Stuff
    /Team2Stuff
    /Team3Stuff

Team1Stuff folder has a property:  team_name = 'Team1'
Team2Stuff folder has a property:  team_name = 'Team2'
Team3Stuff folder has a property:  team_name = 'Team3'

Then you tweak the SQL methods used by UserDB to include a test...

WHERE {existing stuff} AND team = <!--#sqlvar team_name-->

All of the interesting stuff could still go in /top and be acquired into
each Team folder.  We've done that in a number of cases...

</untested>

As I look at this though, it sounds more like you might want to use
roles...  Make Team1, Team2, and Team3 roles and assign them as such in
the user table.  Then you can use organic security/permissions...

What did you want to do with the list of Team1 members?

--Rob