[Checkins] SVN: z3ext.ownership/tags/1.2.0/ release tag
Nikolay Kim
fafhrd91 at gmail.com
Tue Aug 11 05:34:04 EDT 2009
Log message for revision 102663:
release tag
Changed:
A z3ext.ownership/tags/1.2.0/
D z3ext.ownership/tags/1.2.0/CHANGES.txt
A z3ext.ownership/tags/1.2.0/CHANGES.txt
D z3ext.ownership/tags/1.2.0/bootstrap.py
A z3ext.ownership/tags/1.2.0/bootstrap.py
D z3ext.ownership/tags/1.2.0/setup.py
A z3ext.ownership/tags/1.2.0/setup.py
D z3ext.ownership/tags/1.2.0/src/z3ext/ownership/interfaces.py
A z3ext.ownership/tags/1.2.0/src/z3ext/ownership/interfaces.py
D z3ext.ownership/tags/1.2.0/src/z3ext/ownership/localroles.py
A z3ext.ownership/tags/1.2.0/src/z3ext/ownership/localroles.py
D z3ext.ownership/tags/1.2.0/src/z3ext/ownership/owner.py
A z3ext.ownership/tags/1.2.0/src/z3ext/ownership/owner.py
D z3ext.ownership/tags/1.2.0/src/z3ext/ownership/principalgroups.py
A z3ext.ownership/tags/1.2.0/src/z3ext/ownership/principalgroups.py
D z3ext.ownership/tags/1.2.0/src/z3ext/ownership/tests.py
A z3ext.ownership/tags/1.2.0/src/z3ext/ownership/tests.py
-=-
Deleted: z3ext.ownership/tags/1.2.0/CHANGES.txt
===================================================================
--- z3ext.ownership/trunk/CHANGES.txt 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.ownership/tags/1.2.0/CHANGES.txt 2009-08-11 09:34:03 UTC (rev 102663)
@@ -1,45 +0,0 @@
-=======
-CHANGES
-=======
-
-
-1.1.2 (2009-04-??)
-------------------
-
-- Do not use z3c.autoinclude
-
-
-1.1.1 (2009-03-18)
-------------------
-
-- Fixed dependencies
-
-
-1.1.0 (2009-01-27)
-------------------
-
-- Added special IOwnership adapter for IInheritOwnership objects
-
-
-1.0.1 (2008-05-19)
-------------------
-
-- Replace 'autoinclude' with 'includeDependendcies'
-
-
-1.0.0 (2008-03-21)
-------------------
-
-- Moved to svn.zope.org
-
-
-0.99 (2008-03-19)
------------------
-
-- Code cleanup
-
-
-0.9.0 (2008-02-01)
-------------------
-
-- Initial release
Copied: z3ext.ownership/tags/1.2.0/CHANGES.txt (from rev 102662, z3ext.ownership/trunk/CHANGES.txt)
===================================================================
--- z3ext.ownership/tags/1.2.0/CHANGES.txt (rev 0)
+++ z3ext.ownership/tags/1.2.0/CHANGES.txt 2009-08-11 09:34:03 UTC (rev 102663)
@@ -0,0 +1,47 @@
+=======
+CHANGES
+=======
+
+
+1.2.0 (2009-08-11)
+------------------
+
+- Do not use z3c.autoinclude
+
+- Copyright holder changed
+
+
+1.1.1 (2009-03-18)
+------------------
+
+- Fixed dependencies
+
+
+1.1.0 (2009-01-27)
+------------------
+
+- Added special IOwnership adapter for IInheritOwnership objects
+
+
+1.0.1 (2008-05-19)
+------------------
+
+- Replace 'autoinclude' with 'includeDependendcies'
+
+
+1.0.0 (2008-03-21)
+------------------
+
+- Moved to svn.zope.org
+
+
+0.99 (2008-03-19)
+-----------------
+
+- Code cleanup
+
+
+0.9.0 (2008-02-01)
+------------------
+
+- Initial release
Deleted: z3ext.ownership/tags/1.2.0/bootstrap.py
===================================================================
--- z3ext.ownership/trunk/bootstrap.py 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.ownership/tags/1.2.0/bootstrap.py 2009-08-11 09:34:03 UTC (rev 102663)
@@ -1,52 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Bootstrap a buildout-based project
-
-Simply run this script in a directory containing a buildout.cfg.
-The script accepts buildout command-line options, so you can
-use the -c option to specify an alternate configuration file.
-
-$Id$
-"""
-
-import os, shutil, sys, tempfile, urllib2
-
-tmpeggs = tempfile.mkdtemp()
-
-ez = {}
-exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
- ).read() in ez
-ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
-
-import pkg_resources
-
-cmd = 'from setuptools.command.easy_install import main; main()'
-if sys.platform == 'win32':
- cmd = '"%s"' % cmd # work around spawn lamosity on windows
-
-ws = pkg_resources.working_set
-assert os.spawnle(
- os.P_WAIT, sys.executable, sys.executable,
- '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
- dict(os.environ,
- PYTHONPATH=
- ws.find(pkg_resources.Requirement.parse('setuptools')).location
- ),
- ) == 0
-
-ws.add_entry(tmpeggs)
-ws.require('zc.buildout')
-import zc.buildout.buildout
-zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
-shutil.rmtree(tmpeggs)
Copied: z3ext.ownership/tags/1.2.0/bootstrap.py (from rev 102662, z3ext.ownership/trunk/bootstrap.py)
===================================================================
--- z3ext.ownership/tags/1.2.0/bootstrap.py (rev 0)
+++ z3ext.ownership/tags/1.2.0/bootstrap.py 2009-08-11 09:34:03 UTC (rev 102663)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2009 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id$
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+ez = {}
+exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+ ).read() in ez
+ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+import pkg_resources
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+ cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+ os.P_WAIT, sys.executable, sys.executable,
+ '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+ dict(os.environ,
+ PYTHONPATH=
+ ws.find(pkg_resources.Requirement.parse('setuptools')).location
+ ),
+ ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)
Deleted: z3ext.ownership/tags/1.2.0/setup.py
===================================================================
--- z3ext.ownership/trunk/setup.py 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.ownership/tags/1.2.0/setup.py 2009-08-11 09:34:03 UTC (rev 102663)
@@ -1,71 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2008 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Setup for z3ext.ownership package
-
-$Id$
-"""
-import sys, os
-from setuptools import setup, find_packages
-
-def read(*rnames):
- return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-
-version='1.1.2dev'
-
-
-setup(name = 'z3ext.ownership',
- version = version,
- author = 'Nikolay Kim',
- author_email = 'fafhrd91 at gmail.com',
- description = "Content ownership.",
- long_description = (
- 'Detailed Documentation\n' +
- '======================\n'
- + '\n\n' +
- read('src', 'z3ext', 'ownership', 'README.txt')
- + '\n\n' +
- read('CHANGES.txt')
- ),
- classifiers=[
- 'Development Status :: 5 - Production/Stable',
- 'Environment :: Web Environment',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: Zope Public License',
- 'Programming Language :: Python',
- 'Natural Language :: English',
- 'Operating System :: OS Independent',
- 'Topic :: Internet :: WWW/HTTP',
- 'Framework :: Zope3'],
- url='http://z3ext.net/',
- license='ZPL 2.1',
- packages=find_packages('src'),
- package_dir = {'':'src'},
- namespace_packages=['z3ext'],
- install_requires = ['setuptools',
- 'rwproperty',
- 'zope.component',
- 'zope.interface',
- 'zope.security',
- 'zope.securitypolicy',
- 'zope.annotation',
- 'zope.lifecycleevent',
- 'zope.app.security',
- 'z3ext.security',
- ],
- extras_require = dict(test=['zope.app.testing',
- 'zope.testing',
- ]),
- include_package_data = True,
- zip_safe = False
- )
Copied: z3ext.ownership/tags/1.2.0/setup.py (from rev 102662, z3ext.ownership/trunk/setup.py)
===================================================================
--- z3ext.ownership/tags/1.2.0/setup.py (rev 0)
+++ z3ext.ownership/tags/1.2.0/setup.py 2009-08-11 09:34:03 UTC (rev 102663)
@@ -0,0 +1,71 @@
+##############################################################################
+#
+# Copyright (c) 2009 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Setup for z3ext.ownership package
+
+$Id$
+"""
+import sys, os
+from setuptools import setup, find_packages
+
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+version='1.2.0'
+
+
+setup(name = 'z3ext.ownership',
+ version = version,
+ author = 'Nikolay Kim',
+ author_email = 'fafhrd91 at gmail.com',
+ description = "Content ownership.",
+ long_description = (
+ 'Detailed Documentation\n' +
+ '======================\n'
+ + '\n\n' +
+ read('src', 'z3ext', 'ownership', 'README.txt')
+ + '\n\n' +
+ read('CHANGES.txt')
+ ),
+ classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ 'Environment :: Web Environment',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: Zope Public License',
+ 'Programming Language :: Python',
+ 'Natural Language :: English',
+ 'Operating System :: OS Independent',
+ 'Topic :: Internet :: WWW/HTTP',
+ 'Framework :: Zope3'],
+ url='http://z3ext.net/',
+ license='ZPL 2.1',
+ packages=find_packages('src'),
+ package_dir = {'':'src'},
+ namespace_packages=['z3ext'],
+ install_requires = ['setuptools',
+ 'rwproperty',
+ 'zope.component',
+ 'zope.interface',
+ 'zope.security',
+ 'zope.securitypolicy',
+ 'zope.annotation',
+ 'zope.lifecycleevent',
+ 'zope.app.security',
+ 'z3ext.security',
+ ],
+ extras_require = dict(test=['zope.app.testing',
+ 'zope.testing',
+ ]),
+ include_package_data = True,
+ zip_safe = False
+ )
Deleted: z3ext.ownership/tags/1.2.0/src/z3ext/ownership/interfaces.py
===================================================================
--- z3ext.ownership/trunk/src/z3ext/ownership/interfaces.py 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.ownership/tags/1.2.0/src/z3ext/ownership/interfaces.py 2009-08-11 09:34:03 UTC (rev 102663)
@@ -1,64 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2008 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-""" z3ext.ownership interfaces
-
-$Id$
-"""
-from zope import interface
-from zope.security.interfaces import IPrincipal
-from zope.component.interfaces import ObjectEvent, IObjectEvent
-
-
-class IOwnerAware(interface.Interface):
- """ marker interface for objects that supports ownership """
-
-
-class IOwnerGroupAware(IOwnerAware):
- """ marker interface for objects that supports group ownership """
-
-
-class IInheritOwnership(interface.Interface):
- """ marker interface for object that can inherit
- ownership information from parent """
-
-
-class IUnchangeableOwnership(interface.Interface):
- """ marker interface """
-
-
-class IOwnership(interface.Interface):
- """ ownership information """
-
- owner = interface.Attribute(u'IPrincipal object')
-
- ownerId = interface.Attribute(u'Principal id')
-
- isGroup = interface.Attribute(u'Is owner group')
-
-
-class IOwnerChangedEvent(IObjectEvent):
- """ owner of object changed """
-
- newOwner = interface.Attribute('New owner')
-
- oldOwner = interface.Attribute('Old owner')
-
-
-class OwnerChangedEvent(ObjectEvent):
- interface.implements(IOwnerChangedEvent)
-
- def __init__(self, object, newOwner, oldOwner):
- self.object = object
- self.newOwner = newOwner
- self.oldOwner = oldOwner
Copied: z3ext.ownership/tags/1.2.0/src/z3ext/ownership/interfaces.py (from rev 102662, z3ext.ownership/trunk/src/z3ext/ownership/interfaces.py)
===================================================================
--- z3ext.ownership/tags/1.2.0/src/z3ext/ownership/interfaces.py (rev 0)
+++ z3ext.ownership/tags/1.2.0/src/z3ext/ownership/interfaces.py 2009-08-11 09:34:03 UTC (rev 102663)
@@ -0,0 +1,64 @@
+##############################################################################
+#
+# Copyright (c) 2009 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" z3ext.ownership interfaces
+
+$Id$
+"""
+from zope import interface
+from zope.security.interfaces import IPrincipal
+from zope.component.interfaces import ObjectEvent, IObjectEvent
+
+
+class IOwnerAware(interface.Interface):
+ """ marker interface for objects that supports ownership """
+
+
+class IOwnerGroupAware(IOwnerAware):
+ """ marker interface for objects that supports group ownership """
+
+
+class IInheritOwnership(interface.Interface):
+ """ marker interface for object that can inherit
+ ownership information from parent """
+
+
+class IUnchangeableOwnership(interface.Interface):
+ """ marker interface """
+
+
+class IOwnership(interface.Interface):
+ """ ownership information """
+
+ owner = interface.Attribute(u'IPrincipal object')
+
+ ownerId = interface.Attribute(u'Principal id')
+
+ isGroup = interface.Attribute(u'Is owner group')
+
+
+class IOwnerChangedEvent(IObjectEvent):
+ """ owner of object changed """
+
+ newOwner = interface.Attribute('New owner')
+
+ oldOwner = interface.Attribute('Old owner')
+
+
+class OwnerChangedEvent(ObjectEvent):
+ interface.implements(IOwnerChangedEvent)
+
+ def __init__(self, object, newOwner, oldOwner):
+ self.object = object
+ self.newOwner = newOwner
+ self.oldOwner = oldOwner
Deleted: z3ext.ownership/tags/1.2.0/src/z3ext/ownership/localroles.py
===================================================================
--- z3ext.ownership/trunk/src/z3ext/ownership/localroles.py 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.ownership/tags/1.2.0/src/z3ext/ownership/localroles.py 2009-08-11 09:34:03 UTC (rev 102663)
@@ -1,108 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2008 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""
-
-$Id$
-"""
-from zope import interface, component
-from zope.securitypolicy.interfaces import IPrincipalRoleMap
-from zope.securitypolicy.interfaces import Allow, Unset, Deny
-
-from interfaces import \
- IOwnership, IInheritOwnership, IOwnerAware, IOwnerGroupAware
-
-
- at component.adapter(IOwnerAware)
- at interface.implementer(IPrincipalRoleMap)
-def getLocalRoles(context):
- if IInheritOwnership.providedBy(context):
- return
-
- owner = IOwnership(context)
- if owner.isGroup and IOwnerGroupAware.providedBy(context):
- return
- return LocalRoles(context, owner)
-
-
-class LocalRoles(object):
- interface.implements(IPrincipalRoleMap)
-
- def __init__(self, context, owner):
- self.owner = owner
- self.ownerId = owner.ownerId or u''
-
- def getPrincipalsForRole(self, role_id):
- if (role_id == 'content.Owner'):
- return ((self.ownerId, Allow),)
- else:
- return ()
-
- def getRolesForPrincipal(self, principal_id,
- deny = (('content.Owner', Deny),),
- allow = (('content.Owner', Allow),)):
- if principal_id == self.ownerId:
- return allow
- else:
- return deny
-
- def getSetting(self, role_id, principal_id):
- if (principal_id == self.ownerId) and (role_id == 'content.Owner'):
- return Allow
- else:
- return Deny
-
- def getPrincipalsAndRoles(self):
- return ()
-
-
- at component.adapter(IOwnerGroupAware)
- at interface.implementer(IPrincipalRoleMap)
-def getGroupLocalRoles(context):
- if IInheritOwnership.providedBy(context):
- return
-
- owner = IOwnership(context)
- if owner.isGroup:
- return GroupLocalRoles(context, owner)
-
-
-class GroupLocalRoles(object):
- interface.implements(IPrincipalRoleMap)
-
- def __init__(self, context, owner):
- self.owner = owner
- self.ownerId = owner.ownerId
-
- def getPrincipalsForRole(self, role_id):
- if role_id == 'content.GroupOwner':
- return ((self.ownerId, Allow),)
- else:
- return ()
-
- def getRolesForPrincipal(self, principal_id,
- deny = (('content.GroupOwner', Deny),),
- allow = (('content.GroupOwner', Allow),)):
- if principal_id == self.ownerId:
- return allow
- else:
- return deny
-
- def getSetting(self, role_id, principal_id):
- if (principal_id == self.ownerId) and (role_id == 'content.GroupOwner'):
- return Allow
- else:
- return Deny
-
- def getPrincipalsAndRoles(self):
- return ()
Copied: z3ext.ownership/tags/1.2.0/src/z3ext/ownership/localroles.py (from rev 102662, z3ext.ownership/trunk/src/z3ext/ownership/localroles.py)
===================================================================
--- z3ext.ownership/tags/1.2.0/src/z3ext/ownership/localroles.py (rev 0)
+++ z3ext.ownership/tags/1.2.0/src/z3ext/ownership/localroles.py 2009-08-11 09:34:03 UTC (rev 102663)
@@ -0,0 +1,108 @@
+##############################################################################
+#
+# Copyright (c) 2009 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+from zope import interface, component
+from zope.securitypolicy.interfaces import IPrincipalRoleMap
+from zope.securitypolicy.interfaces import Allow, Unset, Deny
+
+from interfaces import \
+ IOwnership, IInheritOwnership, IOwnerAware, IOwnerGroupAware
+
+
+ at component.adapter(IOwnerAware)
+ at interface.implementer(IPrincipalRoleMap)
+def getLocalRoles(context):
+ if IInheritOwnership.providedBy(context):
+ return
+
+ owner = IOwnership(context)
+ if owner.isGroup and IOwnerGroupAware.providedBy(context):
+ return
+ return LocalRoles(context, owner)
+
+
+class LocalRoles(object):
+ interface.implements(IPrincipalRoleMap)
+
+ def __init__(self, context, owner):
+ self.owner = owner
+ self.ownerId = owner.ownerId or u''
+
+ def getPrincipalsForRole(self, role_id):
+ if (role_id == 'content.Owner'):
+ return ((self.ownerId, Allow),)
+ else:
+ return ()
+
+ def getRolesForPrincipal(self, principal_id,
+ deny = (('content.Owner', Deny),),
+ allow = (('content.Owner', Allow),)):
+ if principal_id == self.ownerId:
+ return allow
+ else:
+ return deny
+
+ def getSetting(self, role_id, principal_id):
+ if (principal_id == self.ownerId) and (role_id == 'content.Owner'):
+ return Allow
+ else:
+ return Deny
+
+ def getPrincipalsAndRoles(self):
+ return ()
+
+
+ at component.adapter(IOwnerGroupAware)
+ at interface.implementer(IPrincipalRoleMap)
+def getGroupLocalRoles(context):
+ if IInheritOwnership.providedBy(context):
+ return
+
+ owner = IOwnership(context)
+ if owner.isGroup:
+ return GroupLocalRoles(context, owner)
+
+
+class GroupLocalRoles(object):
+ interface.implements(IPrincipalRoleMap)
+
+ def __init__(self, context, owner):
+ self.owner = owner
+ self.ownerId = owner.ownerId
+
+ def getPrincipalsForRole(self, role_id):
+ if role_id == 'content.GroupOwner':
+ return ((self.ownerId, Allow),)
+ else:
+ return ()
+
+ def getRolesForPrincipal(self, principal_id,
+ deny = (('content.GroupOwner', Deny),),
+ allow = (('content.GroupOwner', Allow),)):
+ if principal_id == self.ownerId:
+ return allow
+ else:
+ return deny
+
+ def getSetting(self, role_id, principal_id):
+ if (principal_id == self.ownerId) and (role_id == 'content.GroupOwner'):
+ return Allow
+ else:
+ return Deny
+
+ def getPrincipalsAndRoles(self):
+ return ()
Deleted: z3ext.ownership/tags/1.2.0/src/z3ext/ownership/owner.py
===================================================================
--- z3ext.ownership/trunk/src/z3ext/ownership/owner.py 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.ownership/tags/1.2.0/src/z3ext/ownership/owner.py 2009-08-11 09:34:03 UTC (rev 102663)
@@ -1,122 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2008 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""
-
-$Id$
-"""
-from rwproperty import getproperty, setproperty
-
-from zope import event, interface, component
-from zope.annotation.interfaces import IAnnotations
-from zope.component.interfaces import ComponentLookupError
-from zope.lifecycleevent.interfaces import IObjectCreatedEvent
-
-from zope.security.proxy import removeSecurityProxy
-from zope.security.interfaces import IPrincipal, IGroup
-
-from z3ext.security.utils import getPrincipal
-
-from z3ext.ownership import interfaces
-from z3ext.ownership.interfaces import IOwnership
-from z3ext.ownership.interfaces import IInheritOwnership
-from z3ext.ownership.interfaces import IUnchangeableOwnership
-from z3ext.ownership.interfaces import OwnerChangedEvent
-
-ANNOTATION_KEY = 'z3ext.ownership.Owner'
-
-
-class Ownership(object):
- component.adapts(interfaces.IOwnerAware)
- interface.implements(IOwnership)
-
- _ownerId = ''
- isGroup = False
-
- def __init__(self, context):
- annotations = IAnnotations(removeSecurityProxy(context))
-
- self.context = context
- self.annotations = annotations
-
- ownerinfo = annotations.get(ANNOTATION_KEY)
- if ownerinfo is None:
- ownerinfo = {'ownerId': None, 'isGroup': False}
- annotations[ANNOTATION_KEY] = ownerinfo
-
- self._ownerId = ownerinfo['ownerId']
- self.isGroup = ownerinfo['isGroup']
-
- @setproperty
- def owner(self, owner):
- if IPrincipal.providedBy(owner):
- oldOwner = self.owner
-
- self._ownerId = owner.id
- self.isGroup = IGroup.providedBy(owner)
-
- self.annotations[ANNOTATION_KEY] = {'ownerId': self._ownerId,
- 'isGroup': self.isGroup}
-
- event.notify(OwnerChangedEvent(self.context, owner, oldOwner))
- else:
- raise ValueError('IPrincipal object is required.')
-
- @getproperty
- def owner(self):
- if self._ownerId:
- return getPrincipal(self._ownerId)
- else:
- return None
-
- @getproperty
- def ownerId(self):
- return self._ownerId
-
- @setproperty
- def ownerId(self, pid):
- self.owner = getPrincipal(pid)
-
-
-class InheritedOwnership(object):
- component.adapts(interfaces.IInheritOwnership)
- interface.implements(IOwnership, IUnchangeableOwnership)
-
- def __init__(self, context):
- parent = context
-
- while IInheritOwnership.providedBy(parent):
- parent = getattr(parent, '__parent__', None)
- if parent is None:
- raise ComponentLookupError()
-
- self._owner = IOwnership(parent)
-
- @property
- def owner(self):
- return self._owner.owner
-
- @property
- def ownerId(self):
- return self._owner.ownerId
-
-
- at component.adapter(interfaces.IOwnerAware, IObjectCreatedEvent)
-def initObjectOwnership(object, event):
- if interfaces.IUnchangeableOwnership.providedBy(object) or \
- interfaces.IInheritOwnership.providedBy(object):
- return
-
- principal = getPrincipal()
- if principal is not None:
- interfaces.IOwnership(removeSecurityProxy(object)).owner = principal
Copied: z3ext.ownership/tags/1.2.0/src/z3ext/ownership/owner.py (from rev 102662, z3ext.ownership/trunk/src/z3ext/ownership/owner.py)
===================================================================
--- z3ext.ownership/tags/1.2.0/src/z3ext/ownership/owner.py (rev 0)
+++ z3ext.ownership/tags/1.2.0/src/z3ext/ownership/owner.py 2009-08-11 09:34:03 UTC (rev 102663)
@@ -0,0 +1,122 @@
+##############################################################################
+#
+# Copyright (c) 2009 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+from rwproperty import getproperty, setproperty
+
+from zope import event, interface, component
+from zope.annotation.interfaces import IAnnotations
+from zope.component.interfaces import ComponentLookupError
+from zope.lifecycleevent.interfaces import IObjectCreatedEvent
+
+from zope.security.proxy import removeSecurityProxy
+from zope.security.interfaces import IPrincipal, IGroup
+
+from z3ext.security.utils import getPrincipal
+
+from z3ext.ownership import interfaces
+from z3ext.ownership.interfaces import IOwnership
+from z3ext.ownership.interfaces import IInheritOwnership
+from z3ext.ownership.interfaces import IUnchangeableOwnership
+from z3ext.ownership.interfaces import OwnerChangedEvent
+
+ANNOTATION_KEY = 'z3ext.ownership.Owner'
+
+
+class Ownership(object):
+ component.adapts(interfaces.IOwnerAware)
+ interface.implements(IOwnership)
+
+ _ownerId = ''
+ isGroup = False
+
+ def __init__(self, context):
+ annotations = IAnnotations(removeSecurityProxy(context))
+
+ self.context = context
+ self.annotations = annotations
+
+ ownerinfo = annotations.get(ANNOTATION_KEY)
+ if ownerinfo is None:
+ ownerinfo = {'ownerId': None, 'isGroup': False}
+ annotations[ANNOTATION_KEY] = ownerinfo
+
+ self._ownerId = ownerinfo['ownerId']
+ self.isGroup = ownerinfo['isGroup']
+
+ @setproperty
+ def owner(self, owner):
+ if IPrincipal.providedBy(owner):
+ oldOwner = self.owner
+
+ self._ownerId = owner.id
+ self.isGroup = IGroup.providedBy(owner)
+
+ self.annotations[ANNOTATION_KEY] = {'ownerId': self._ownerId,
+ 'isGroup': self.isGroup}
+
+ event.notify(OwnerChangedEvent(self.context, owner, oldOwner))
+ else:
+ raise ValueError('IPrincipal object is required.')
+
+ @getproperty
+ def owner(self):
+ if self._ownerId:
+ return getPrincipal(self._ownerId)
+ else:
+ return None
+
+ @getproperty
+ def ownerId(self):
+ return self._ownerId
+
+ @setproperty
+ def ownerId(self, pid):
+ self.owner = getPrincipal(pid)
+
+
+class InheritedOwnership(object):
+ component.adapts(interfaces.IInheritOwnership)
+ interface.implements(IOwnership, IUnchangeableOwnership)
+
+ def __init__(self, context):
+ parent = context
+
+ while IInheritOwnership.providedBy(parent):
+ parent = getattr(parent, '__parent__', None)
+ if parent is None:
+ raise ComponentLookupError()
+
+ self._owner = IOwnership(parent)
+
+ @property
+ def owner(self):
+ return self._owner.owner
+
+ @property
+ def ownerId(self):
+ return self._owner.ownerId
+
+
+ at component.adapter(interfaces.IOwnerAware, IObjectCreatedEvent)
+def initObjectOwnership(object, event):
+ if interfaces.IUnchangeableOwnership.providedBy(object) or \
+ interfaces.IInheritOwnership.providedBy(object):
+ return
+
+ principal = getPrincipal()
+ if principal is not None:
+ interfaces.IOwnership(removeSecurityProxy(object)).owner = principal
Deleted: z3ext.ownership/tags/1.2.0/src/z3ext/ownership/principalgroups.py
===================================================================
--- z3ext.ownership/trunk/src/z3ext/ownership/principalgroups.py 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.ownership/tags/1.2.0/src/z3ext/ownership/principalgroups.py 2009-08-11 09:34:03 UTC (rev 102663)
@@ -1,33 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2008 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""
-
-$Id$
-"""
-from zope import interface, component
-from zope.component import queryUtility
-from zope.app.security.interfaces import IUnauthenticatedPrincipal
-
-from z3ext.security.interfaces import IPrincipalGroups
-from z3ext.ownership.interfaces import IOwnerAware, IOwnership
-
-
- at component.adapter(IOwnerAware)
- at interface.implementer(IPrincipalGroups)
-def principalGroups(content):
- owner = IOwnership(content).owner
- if owner is None:
- owner = queryUtility(IUnauthenticatedPrincipal)
-
- return IPrincipalGroups(owner, None)
Copied: z3ext.ownership/tags/1.2.0/src/z3ext/ownership/principalgroups.py (from rev 102662, z3ext.ownership/trunk/src/z3ext/ownership/principalgroups.py)
===================================================================
--- z3ext.ownership/tags/1.2.0/src/z3ext/ownership/principalgroups.py (rev 0)
+++ z3ext.ownership/tags/1.2.0/src/z3ext/ownership/principalgroups.py 2009-08-11 09:34:03 UTC (rev 102663)
@@ -0,0 +1,33 @@
+##############################################################################
+#
+# Copyright (c) 2009 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+from zope import interface, component
+from zope.component import queryUtility
+from zope.app.security.interfaces import IUnauthenticatedPrincipal
+
+from z3ext.security.interfaces import IPrincipalGroups
+from z3ext.ownership.interfaces import IOwnerAware, IOwnership
+
+
+ at component.adapter(IOwnerAware)
+ at interface.implementer(IPrincipalGroups)
+def principalGroups(content):
+ owner = IOwnership(content).owner
+ if owner is None:
+ owner = queryUtility(IUnauthenticatedPrincipal)
+
+ return IPrincipalGroups(owner, None)
Deleted: z3ext.ownership/tags/1.2.0/src/z3ext/ownership/tests.py
===================================================================
--- z3ext.ownership/trunk/src/z3ext/ownership/tests.py 2009-08-10 17:22:44 UTC (rev 102631)
+++ z3ext.ownership/tags/1.2.0/src/z3ext/ownership/tests.py 2009-08-11 09:34:03 UTC (rev 102663)
@@ -1,68 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2008 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""
-
-$Id$
-"""
-import unittest, doctest
-from zope import interface, component
-from zope.app.testing import placelesssetup
-from zope.annotation.attribute import AttributeAnnotations
-
-import zope.security.management
-from zope.security.interfaces import IPrincipal
-from z3ext.security import tests as sectests
-from z3ext.security.securitypolicy import SecurityPolicy
-
-from z3ext.ownership.owner import initObjectOwnership
-from z3ext.ownership.owner import Ownership, InheritedOwnership
-from z3ext.ownership.localroles import getLocalRoles, getGroupLocalRoles
-from z3ext.ownership.interfaces import IOwnership, IInheritOwnership
-
-
-class Principal:
- interface.implements(IPrincipal)
-
- def __init__(self, id):
- self.id = id
- self.title = id
- self.groups = []
-
- def __repr__(self):
- return "<Principal '%s'>"%self.id
-
-class Participation:
- interaction = None
-
-
-def setUp(test):
- sectests.setUp(test)
- zope.security.management.setSecurityPolicy(SecurityPolicy)
-
- sm = component.getSiteManager()
- sm.registerAdapter(Ownership)
- sm.registerAdapter(InheritedOwnership, (IInheritOwnership,), IOwnership)
- sm.registerAdapter(getLocalRoles, name="z3ext.ownership-owner")
- sm.registerAdapter(getGroupLocalRoles, name="z3ext.ownership-groupowner")
- sm.registerAdapter(AttributeAnnotations)
- sm.registerHandler(initObjectOwnership)
-
-
-def test_suite():
- return unittest.TestSuite((
- doctest.DocFileSuite(
- 'README.txt',
- setUp=setUp, tearDown=placelesssetup.tearDown,
- optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
- ))
Copied: z3ext.ownership/tags/1.2.0/src/z3ext/ownership/tests.py (from rev 102662, z3ext.ownership/trunk/src/z3ext/ownership/tests.py)
===================================================================
--- z3ext.ownership/tags/1.2.0/src/z3ext/ownership/tests.py (rev 0)
+++ z3ext.ownership/tags/1.2.0/src/z3ext/ownership/tests.py 2009-08-11 09:34:03 UTC (rev 102663)
@@ -0,0 +1,68 @@
+##############################################################################
+#
+# Copyright (c) 2009 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+import unittest, doctest
+from zope import interface, component
+from zope.app.testing import placelesssetup
+from zope.annotation.attribute import AttributeAnnotations
+
+import zope.security.management
+from zope.security.interfaces import IPrincipal
+from z3ext.security import tests as sectests
+from z3ext.security.securitypolicy import SecurityPolicy
+
+from z3ext.ownership.owner import initObjectOwnership
+from z3ext.ownership.owner import Ownership, InheritedOwnership
+from z3ext.ownership.localroles import getLocalRoles, getGroupLocalRoles
+from z3ext.ownership.interfaces import IOwnership, IInheritOwnership
+
+
+class Principal:
+ interface.implements(IPrincipal)
+
+ def __init__(self, id):
+ self.id = id
+ self.title = id
+ self.groups = []
+
+ def __repr__(self):
+ return "<Principal '%s'>"%self.id
+
+class Participation:
+ interaction = None
+
+
+def setUp(test):
+ sectests.setUp(test)
+ zope.security.management.setSecurityPolicy(SecurityPolicy)
+
+ sm = component.getSiteManager()
+ sm.registerAdapter(Ownership)
+ sm.registerAdapter(InheritedOwnership, (IInheritOwnership,), IOwnership)
+ sm.registerAdapter(getLocalRoles, name="z3ext.ownership-owner")
+ sm.registerAdapter(getGroupLocalRoles, name="z3ext.ownership-groupowner")
+ sm.registerAdapter(AttributeAnnotations)
+ sm.registerHandler(initObjectOwnership)
+
+
+def test_suite():
+ return unittest.TestSuite((
+ doctest.DocFileSuite(
+ 'README.txt',
+ setUp=setUp, tearDown=placelesssetup.tearDown,
+ optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
+ ))
More information about the Checkins
mailing list