diff --git a/organize/util.py b/organize/util.py index b8a35e9..e809434 100644 --- a/organize/util.py +++ b/organize/util.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2011 Helmut Merz helmutm@cy55.de +# Copyright (c) 2013 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,8 +18,6 @@ """ Utilities for the loops.organize package. - -$Id$ """ from zope import interface, component, schema @@ -31,6 +29,7 @@ from zope.app.security.settings import Allow, Deny, Unset from zope.securitypolicy.interfaces import IPrincipalRoleManager from zope.traversing.api import getParents from loops.common import adapted +from loops.security.common import getCurrentPrincipal from loops.type import getOptionsDict defaultAuthPluginId = 'loops' @@ -131,6 +130,13 @@ def getRolesForPrincipal(id, context): return result +def getGroupsForPrincipal(principal=None): + if principal is None: + principal = getCurrentPrincipal() + gf = getGroupsFolder() + return gf.getGroupsForPrincipal(principal.id) + + def getTrackingStorage(obj, name): records = obj.getLoopsRoot().getRecordManager() if records is not None: