[Zope] Can I *add* to the roles a user has?
Tony McDonald
tony.mcdonald@ncl.ac.uk
Thu, 19 Jul 2001 10:53:35 +0100
On 17/7/01 12:56 pm, "Jens Vagelpohl" <jens@digicool.com> wrote:
> tony,
>
> there is no API to modify a user object after creation because assembling
> a user from several data sources like you're doing wasn't anticipated.
>
> one way out would be to subclass from UserDB and add a method to do both
> role lookups at once, then you would replace all those calls that look up
> roles with a call to your custom method. if you have several sites that
> assemble the roles differently you would only have to replace the custom
> role lookup method and provide the necessary infrastructure for it (SQL,
> db connections and such).
>
> jens
>
Cheers for that Jens, at least it's saved me going loopy trying to figure
out a clean way of doing it.
I guess I'll look at subclassing UserDB. I tried using pluggable brains with
the SQL method, but the authentication seems to be happening earlier. That
is my SQL query returns 'username', 'password', 'domains', 'partroles' and
my pluggable brain (fantastic term!) brings back 'roles' as a combination of
partroles and another SQL lookup (at least that's the theory - it doesn't
seem to be working).
Thanks
Tone.
--
Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/
The Medical School, Newcastle University Tel: +44 191 243 6140
A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope