[ZPatterns] thanks and question
Steve Spicklemire
[email protected]
Fri, 11 Oct 2002 08:54:14 -0500
Hi Rob,
Hmm.. I would've expected something more like "permission denied". Can
you tell us a bit more about the containment hierarchy of these
objects? (Esp relative to your LoginManager, and the customizer?)
Also.. which roles have the "Access Contents Information" in the folder
that contains the to "getMembersWithRole" script?
-steve
On Friday, October 11, 2002, at 01:39 AM, Rob Miller wrote:
> hi all,
>
> i just stumbled across this list and have read the last couple of
> month's archives. what a nice surprise! thanks, roche, for your new
> documentation and releases. i very much support seeing all the
> existing code put into cvs. i've been digging pretty deeply into
> things lately since i'm using zpatterns and loginmanager as the basis
> for a sizable project. i would love to be able to make improvements
> to the framework and to submit them to an active project for
> everyone's benefit. i've already submitted a patch to casey, author
> of externaleditor, so that the external editor icons will show up
> correctly within folders w/ customizer support; i'm hoping he includes
> it in his next release.
>
> anyway, the reason i sought out this list is because i have a fairly
> low-level problem that i'm hoping someone can help me with. here's the
> sitch:
>
> i've got two dataskin zclasses, one called BRCMember and one called
> TeamFolder. they each have a python base class that i've created (in a
> filesystem product), called BRCMemberBase and TeamFolderBase,
> respectively. BRCMemberBase subclasses LoginManager's LoginUser,
> TeamFolderBase subclasses both DataSkin and the regular zope Folder
> object, like so:
>
> in the TeamFolderBase class, i have a 'get_local_roles_for_userid'
> method. this method overrides (and extends) RoleManager's
> 'get_local_roles_for_userid' method, which, i believe, zope calls when
> checking security for every page access. my version of this method
> looks like this:
>
>
> def get_local_roles_for_userid(self, userid, roles=()):
> # as near as i can tell the 'roles' argument does nothing... see
> # Products/LoginManager/LoginManager.py and AccessControl/Role.py
> retlist = Folder.get_local_roles_for_userid(self, userid, roles)
> if userid in self.member_list: #<--- THIS IS THE TROUBLE
> retlist.append('member')
> return retlist
>
>
> i've marked the problem spot... the member_list attribute is a
> zpatterns attribute... the data comes from a skinscript that lives in
> a TeamFolder customizer containing the following line:
>
>
> WITH getMembersWithRole(team_id=self.team_id, team_role_id=1)
> COMPUTE member_list = RESULT
>
>
> 'getMembersWithRole' is a python script that lives in the customizer
> itself. normally, it works fine; i access the 'member_list' attribute
> from within my pages frequently. whenever my local roles code gets
> called at authentication time, though, the zpatterns plumbing breaks
> down, and I get the following:
>
>
> Error Type: NameError
> Error Value: global name 'getMembersWithRole' is not defined
>
>
> the traceback shows that the zpatterns AttributeProviders mechanism is
> kicking in appropriately. it seems as though the skinscript's
> acquisition hierarchy has broken down, or something.
>
> one important point is that using 'user.has_permission()' in a ZPT or
> a dtml page _does_ work... the local roles are enforced as expected.
> it's only when this code gets executed during the page authentication
> that the problem occurs.
>
> does anybody know why this might be happening? if not, i'd settle for
> a workaround: has anyone using ZPatterns and LoginManager successfully
> gotten local roles information to come out of a SQL database using
> another method?
>
> thanks!
>
> -r
>
> _______________________________________________
> ZPatterns mailing list
> [email protected]
> http://www.eby-sarna.com/mailman/listinfo/zpatterns