[Zope-CMF] checking permissions from python

Ignacio Dosil Lago idosil@ccietic.usc.es
Mon, 12 May 2003 13:21:47 +0200


On Saturday 10 May 2003 18:29, martin f krafft wrote:
> i'd like to check for the ManageProperties permission of an object
> in the current context of the logged in useri from within a ZPT. the
> best I could find was:
>
>  
> python:here.portal_membership.checkPermission(CMFCorePermissions.ManageProp
>erties, here)
>
> However, this complains about CMFCorePermissions not found.
>
> How do I check for the ManageProperties permission of the here
> object?

I use securityManager within python scripts and then use the script from a 
ZPT. It could be something like this:

from AccessControl import getSecurityManager

if getSecurityManager().checkPermission('View', item):
  return 1
else:
  return 0

Cheers!!