Plone Scripting Question / David Diskin <david.diskin@verizon.net>
| Plone Scripting Question
David Diskin <david.diskin(at)verizon.net> |
2005-03-26 15:57:20 | [ FULL ] |
fellow ZPUGDC'ers, I'm trying to write a script that will determine if the user is part of a particular (gruf) group. I've seen this construct: "context.portal_membership.getAuthenticatedMember().getRoles()". I was hoping there was a similar method called "getGroups()". My problem is I can't find which interface or class defines getRoles() or I would look at the apis there myself. I've tried looking everywhere I can think. Can someone help me on this -and tell me where I can look for such a method? Is there a user interface/class that defines such methods? Thanks very much. ============================== David Diskin, david.diskin(at)verizon.net |
|||||
|
Re: [ZPUGDC] Plone Scripting Question / Matthew T.Kromer <MATTHEW.T.KROMER@saic.com>
| Re: [ZPUGDC] Plone Scripting Question
Matthew T.Kromer <MATTHEW.T.KROMER(at)saic.com> |
2005-03-28 09:37:50 | [ FULL ] |
The answer to this requires your using GRUF. If so, you should be able to use the getGroups() method on the GRUF user wrapper. Caveat: you can't do this from a python script, because the method is marked private. The easiest way to get around that is to use an external method. GRUF is required because these are actually methods on a user object, and the core Zope user interface has no real concept of group (later Zope versions have made some allowances, but the underlying Zope structure is based on role assignment). GRUF wraps the original user provider object with one which has a group support interface. Take a look at the GroupUserFolder/GRUFUser.py file for the details. On Mar 26, 2005, at 5:11 PM, David Diskin wrote: [...] |
