[Zope-dev] Objects, Roles and Permissions

richard@bizarsoftware.com.au richard@bizarsoftware.com.au
Wed, 11 Apr 2001 08:55:24 +1000


"Randall F. Kern" wrote:
> I haven't worked with this code closely in a few months, but as I recall
> permissions that are acquired are stored as a list, and those that
> aren't are stored as a tuple.
> 
> if type(self._View_Permission) == type(()):
>         # done, this permission isn't acquired above this point
> 
> Furthermore, I may be missing the point of this thread, but if you are
> trying to get the list of all roles assigned to a permission (from a
> python product), you could use this:
> 
> from AccessControl.PermissionRole import rolesFromPermissionOn
> 
> roles = rolesFromPermissionOn('View', ob)

Whoah! Yet another hidden Zope gem. Sometimes this is soooo frustrating!!!

And it's roles_For_PermissionOn, not From... it does the job though...



    Richard

-- 
Richard Jones
richard@bizarsoftware.com.au
Senior Software Developer, Bizar Software (www.bizarsoftware.com.au)