Created
March 16, 2009 13:22
-
-
Save dirceu/79872 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Products.CMFCore.utils import getToolByName | |
from zLOG import LOG, INFO | |
def testOwnerInAclUsers(self): | |
portal = getToolByName(self, 'portal_url').getPortalObject() | |
# FIXME: pegar a lista abaixo programaticamente | |
zope_users = [] # lista de usuários no acl_users *do Zope* | |
plone_users = map(str, portal.acl_users.getUsers()) | |
users = zope_users + plone_users | |
def inner_function(obj, path): | |
owner = str(obj.getOwner()) | |
if owner in users: | |
LOG("OWNER OK", INFO, str(obj.getId())) | |
else: | |
LOG("USER NOT FOUND", INFO, owner) | |
return inner_function | |
def verifyOrphanObjects(self): | |
catalog = getToolByName(self, 'portal_catalog') | |
portal = getToolByName(self, 'portal_url').getPortalObject() | |
types = getToolByName(self, 'portal_types').listContentTypes() | |
return catalog.ZopeFindAndApply(portal, obj_metatypes=types, search_sub=True, apply_func=testOwnerInAclUsers(self)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment