[Zope] Getting permission information in Python (hasRole/getRoles ?)

Emmanuel Viennet emmanuel.viennet@lipn.univ-paris13.fr
Sun, 30 Dec 2001 15:38:47 +0100


  OK, I found a solution to my problem, which looks like this:

  from AccessControl import getSecurityManager
  user = getSecurityManager().getUser()

  if user.has_permission( 'Access contents information', obj ):
    # do the job...

BTW, the Zope API documentation (Zope Book, 
http://www.zope.org/Members/michel/ZB/AppendixB.dtml)
seems outdated; there should be a warning: I prefer no documentation 
(but access to the source code :-) to incorrect or obsolete documentation !)

Emmanuel