[Zope-Checkins] SVN: Zope/trunk/ Remove remaining support classes for defining permissions TTW.
Hanno Schlichting
hannosch at hannosch.eu
Sat Jun 5 15:07:49 EDT 2010
Log message for revision 113165:
Remove remaining support classes for defining permissions TTW.
Changed:
U Zope/trunk/doc/CHANGES.rst
U Zope/trunk/src/AccessControl/Role.py
U Zope/trunk/src/App/Permission.py
U Zope/trunk/src/App/Product.py
U Zope/trunk/src/App/ProductRegistry.py
D Zope/trunk/src/App/dtml/addPermission.dtml
D Zope/trunk/src/App/dtml/editPermission.dtml
U Zope/trunk/src/OFS/ObjectManager.py
U Zope/trunk/src/OFS/deprecated.zcml
D Zope/trunk/src/Products/OFSP/help/Zope-Permission.stx
D Zope/trunk/src/Products/OFSP/help/Zope-Permission_Add.stx
D Zope/trunk/src/Products/OFSP/help/Zope-Permission_Edit.stx
-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst 2010-06-05 18:43:44 UTC (rev 113164)
+++ Zope/trunk/doc/CHANGES.rst 2010-06-05 19:07:49 UTC (rev 113165)
@@ -11,6 +11,8 @@
Restructuring
+++++++++++++
+- Remove remaining support classes for defining permissions TTW.
+
- Moved ``TaintedString`` into the new AccessControl.tainted module.
- Moved the ``zExceptions`` package into its own distribution.
Modified: Zope/trunk/src/AccessControl/Role.py
===================================================================
--- Zope/trunk/src/AccessControl/Role.py 2010-06-05 18:43:44 UTC (rev 113164)
+++ Zope/trunk/src/AccessControl/Role.py 2010-06-05 19:07:49 UTC (rev 113165)
@@ -594,9 +594,6 @@
Products_permissions = getattr(Products, '__ac_permissions__', ())
for p in Products_permissions:
d[p[0]]=1
- for p in self.aq_acquire('_getProductRegistryData')('ac_permissions'):
- d[p[0]]=1
-
for p in self.ac_inherited_permissions(1):
d[p[0]]=1
Modified: Zope/trunk/src/App/Permission.py
===================================================================
--- Zope/trunk/src/App/Permission.py 2010-06-05 18:43:44 UTC (rev 113164)
+++ Zope/trunk/src/App/Permission.py 2010-06-05 19:07:49 UTC (rev 113165)
@@ -10,19 +10,14 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
-__doc__='''Zope registerable permissions
+'''Zope registerable permissions
+'''
-$Id$'''
-__version__='$Revision: 1.9 $'[11:-2]
-from AccessControl.Permissions import view_management_screens
-from AccessControl.Permissions import define_permissions
from AccessControl.Role import RoleManager
from AccessControl.SecurityInfo import ClassSecurityInfo
from Acquisition import Implicit
from App.class_init import InitializeClass
-from App.special_dtml import DTMLFile
-from ExtensionClass import Base
from OFS.SimpleItem import Item
from Persistence import Persistent
@@ -35,14 +30,11 @@
"""
meta_type = 'Zope Permission'
icon = 'p_/Permission_icon'
+ index_html = None
security = ClassSecurityInfo()
manage_options=(
- (
- {'label':'Edit', 'action':'manage_main',
- 'help':('OFSP', 'Zope-Permission_Edit.stx')},
- )
- + RoleManager.manage_options
+ RoleManager.manage_options
+ Item.manage_options
)
@@ -51,63 +43,4 @@
self.title=title
self.name=name
- security.declareProtected(define_permissions, 'manage_edit')
- def manage_edit(self, title, name, REQUEST=None):
- "Modify Permission properties."
- if title != self.title: self.title=title
- if name != self.name:
- self._unregister()
- self.name=name
- self._register()
- if REQUEST is not None: return self.manage_main(self, REQUEST)
-
- security.declarePrivate('manage_afterAdd')
- def manage_afterAdd(self, item, container):
- self._register()
-
- security.declarePrivate('manage_beforeDelete')
- def manage_beforeDelete(self, item, container):
- self._unregister()
-
- def _register(self):
- # Register with the product folder
- product = self.aq_parent
- product.aq_acquire('_manage_add_product_permission')(
- product, self.name)
-
- def _unregister(self):
- # Unregister with the product folder
- product = self.aq_parent
- product.aq_acquire('_manage_remove_product_permission')(
- product, self.name)
-
- security.declareProtected(view_management_screens, 'manage_main')
- manage_main = DTMLFile('dtml/editPermission', globals())
-
- index_html = None
-
InitializeClass(Permission)
-
-
-class PermissionManager(Base):
-
- security = ClassSecurityInfo()
-
- meta_types={
- 'name': Permission.meta_type, 'action': 'manage_addPermissionForm'
- },
-
- security.declareProtected(define_permissions, 'manage_addPermissionForm')
- manage_addPermissionForm = DTMLFile('dtml/addPermission', globals())
-
- security.declareProtected(define_permissions, 'manage_addPermission')
- def manage_addPermission(
- self, id, title, permission, REQUEST=None):
- """ Add a TTW permission.
- """
- i=Permission(id, title, permission)
- self._setObject(id, i)
- if REQUEST is not None:
- return self.manage_main(self, REQUEST, update_menu=1)
-
-InitializeClass(PermissionManager)
Modified: Zope/trunk/src/App/Product.py
===================================================================
--- Zope/trunk/src/App/Product.py 2010-06-05 18:43:44 UTC (rev 113164)
+++ Zope/trunk/src/App/Product.py 2010-06-05 19:07:49 UTC (rev 113165)
@@ -45,9 +45,7 @@
from App.special_dtml import DTMLFile
from OFS.Folder import Folder
-from App.Permission import PermissionManager
-
class ProductFolder(Folder):
"Manage a collection of Products"
@@ -71,7 +69,7 @@
InitializeClass(ProductFolder)
-class Product(Folder, PermissionManager):
+class Product(Folder):
"""Model a product that can be created through the web.
"""
@@ -83,10 +81,6 @@
configurable_objects_=()
import_error_=None
- meta_types=(
- PermissionManager.meta_types
- )
-
manage_options = (
(Folder.manage_options[0],) +
tuple(Folder.manage_options[2:])
Modified: Zope/trunk/src/App/ProductRegistry.py
===================================================================
--- Zope/trunk/src/App/ProductRegistry.py 2010-06-05 18:43:44 UTC (rev 113164)
+++ Zope/trunk/src/App/ProductRegistry.py 2010-06-05 19:07:49 UTC (rev 113165)
@@ -21,8 +21,6 @@
# will return:
# ....what?
-from OFS.Folder import Folder
-
class ProductRegistryMixin:
# This class implements a protocol for registering products that
# are defined through the web.
@@ -73,44 +71,6 @@
self._setProductRegistryMetaTypes(meta_types+(mt,))
- def _manage_remove_product_permission(self, product, permission=None):
- r=[]
- r2=[]
- pid=product.id
- for d in self._getProductRegistryData('permissions'):
- if d.has_key('product'):
- if d['product']==pid and (
- permission is None or permission==d['name']):
- continue
- elif permission==d['name']: continue
- r.append(d)
- r2.append((d['name'], d['methods'], d['default']))
-
- self._setProductRegistryData('permissions', tuple(r))
- self._setProductRegistryData('ac_permissions', tuple(r2))
-
- def _manage_add_product_permission(
- self, product, permission, methods=(), default=('Manager',)
- ):
-
- permissions=self._getProductRegistryData('permissions')
-
- for d in permissions:
- if d['name']==permission:
- raise ValueError, (
- 'The permission <em>%s</em> is already defined.'
- % permission)
-
- d={'name': permission, 'methods': methods, 'permission': permission,
- 'default': default, 'product': product.id}
-
- self._setProductRegistryData('permissions', permissions + (d,))
- self._setProductRegistryData(
- 'ac_permissions',
- self._getProductRegistryData('ac_permissions')
- +((d['name'], d['methods'], d['default']),)
- )
-
# HACK - sometimes an unwrapped App object seems to be passed as
# self to these methods, which means that they dont have an aq_aquire
# method. Until Jim has time to look into this, this aq_maybe method
@@ -143,7 +103,6 @@
self.aq_maybe('_setProductRegistryData')(type, tuple(values))
-
class ProductRegistry(ProductRegistryMixin):
# This class implements a protocol for registering products that
# are defined through the web. It also provides methods for
@@ -154,12 +113,13 @@
def _getProducts(self): return self.Control_Panel.Products
_product_meta_types=()
- _product_permissions=()
- _product_ac_permissions=()
- def _getProductRegistryMetaTypes(self): return self._product_meta_types
- def _setProductRegistryMetaTypes(self, v): self._product_meta_types=v
+ def _getProductRegistryMetaTypes(self):
+ return self._product_meta_types
+ def _setProductRegistryMetaTypes(self, v):
+ self._product_meta_types=v
+
def _getProductRegistryData(self, name):
return getattr(self, '_product_%s' % name)
Deleted: Zope/trunk/src/App/dtml/addPermission.dtml
===================================================================
--- Zope/trunk/src/App/dtml/addPermission.dtml 2010-06-05 18:43:44 UTC (rev 113164)
+++ Zope/trunk/src/App/dtml/addPermission.dtml 2010-06-05 19:07:49 UTC (rev 113165)
@@ -1,56 +0,0 @@
-<dtml-var manage_page_header>
-
-<dtml-var "manage_form_title(this(), _,
- form_title='Add Permission',
- help_product='OFSP',
- help_topic='Zope-Permission_Add.stx'
- )">
-
-<form action="manage_addPermission" method="POST">
-<table cellspacing="0" cellpadding="2" border="0">
- <tr>
- <td align="left" valign="top">
- <div class="form-label">
- Id
- </div>
- </td>
- <td align="left" valign="top">
- <input type="text" name="id" size="40" />
- </td>
- </tr>
-
- <tr>
- <td align="left" valign="top">
- <div class="form-optional">
- Title
- </div>
- </td>
- <td align="left" valign="top">
- <input type="text" name="title" size="40" />
- </td>
- </tr>
-
- <tr>
- <td align="left" valign="top">
- <div class="form-label">
- Name
- </div>
- </td>
- <td align="left" valign="top">
- <input type="text" name="permission" size="40" />
- </td>
- </tr>
-
- <tr>
- <td></td>
- <td align="left" valign="top">
- <div class="form-element">
- <br />
- <input type="submit" name="submit" value="Generate" />
- </div>
- </td>
- </tr>
-</table>
-</form>
-
-<dtml-var manage_page_footer>
Deleted: Zope/trunk/src/App/dtml/editPermission.dtml
===================================================================
--- Zope/trunk/src/App/dtml/editPermission.dtml 2010-06-05 18:43:44 UTC (rev 113164)
+++ Zope/trunk/src/App/dtml/editPermission.dtml 2010-06-05 19:07:49 UTC (rev 113165)
@@ -1,52 +0,0 @@
-<dtml-var manage_page_header>
-<dtml-var manage_tabs>
-
-<form action="manage_edit" method="POST">
-<table cellpadding="2" cellspacing="0" border="0">
-<tr>
- <td align="left" valign="top">
- <div class="form-label">
- Id
- </div>
- </td>
- <td align="left" valign="top">
- <div class="form-text">
- &dtml-id;
- </div>
- </td>
-</tr>
-
-<tr>
- <td align="left" valign="top">
- <div class="form-optional">
- Title
- </div>
- </td>
- <td align="left" valign="top">
- <input type="text" name="title"size="40" value="&dtml-title;" />
- </td>
-</tr>
-
-<tr>
- <td align="left" valign="top">
- <div class="form-label">
- Name
- </div>
- </td>
- <td align="left" valign="top">
- <input type="text" name="name" size="40" value="&dtml-name;" />
- </td>
-</tr>
-
-<tr>
- <td></td>
- <td>
- <div class="form-element">
- <input type="submit" name="submit" value="Save Changes">
- </div>
- </td>
-</tr>
-</table>
-</form>
-
-<dtml-var manage_page_footer>
Modified: Zope/trunk/src/OFS/ObjectManager.py
===================================================================
--- Zope/trunk/src/OFS/ObjectManager.py 2010-06-05 18:43:44 UTC (rev 113164)
+++ Zope/trunk/src/OFS/ObjectManager.py 2010-06-05 19:07:49 UTC (rev 113165)
@@ -265,9 +265,7 @@
def _subobject_permissions(self):
import Products
Products_permissions = getattr(Products, '__ac_permissions__', ())
- return (Products_permissions +
- self.aq_acquire('_getProductRegistryData')('ac_permissions')
- )
+ return Products_permissions
def filtered_meta_types(self, user=None):
# Return a list of the types for which the user has
Modified: Zope/trunk/src/OFS/deprecated.zcml
===================================================================
--- Zope/trunk/src/OFS/deprecated.zcml 2010-06-05 18:43:44 UTC (rev 113164)
+++ Zope/trunk/src/OFS/deprecated.zcml 2010-06-05 19:07:49 UTC (rev 113165)
@@ -7,9 +7,6 @@
class="AccessControl.User.BasicUserFolder"/>
<five:deprecatedManageAddDelete
- class="App.Permission.Permission"/>
-
- <five:deprecatedManageAddDelete
class="HelpSys.HelpTopic.HelpTopicBase"/>
<five:deprecatedManageAddDelete
Deleted: Zope/trunk/src/Products/OFSP/help/Zope-Permission.stx
===================================================================
--- Zope/trunk/src/Products/OFSP/help/Zope-Permission.stx 2010-06-05 18:43:44 UTC (rev 113164)
+++ Zope/trunk/src/Products/OFSP/help/Zope-Permission.stx 2010-06-05 19:07:49 UTC (rev 113165)
@@ -1,5 +0,0 @@
-Zope Permission: Define new Permissions.
-
- Description
-
- Zope Permissions allow you to define new permissions.
Deleted: Zope/trunk/src/Products/OFSP/help/Zope-Permission_Add.stx
===================================================================
--- Zope/trunk/src/Products/OFSP/help/Zope-Permission_Add.stx 2010-06-05 18:43:44 UTC (rev 113164)
+++ Zope/trunk/src/Products/OFSP/help/Zope-Permission_Add.stx 2010-06-05 19:07:49 UTC (rev 113165)
@@ -1,16 +0,0 @@
-Zope Permission - Add: Create a new Permission.
-
- Description
-
- This view allows you to create a new Permission.
-
- Controls
-
- 'Id' -- The id of the Zope Permission.
-
- 'Title' -- The optional title of the Zope Permission.
-
- 'Name' -- Allows you to specify the name of the permission.
- **Note: A permission's name must be unique.**
-
- 'Add' -- Create a Permission.
Deleted: Zope/trunk/src/Products/OFSP/help/Zope-Permission_Edit.stx
===================================================================
--- Zope/trunk/src/Products/OFSP/help/Zope-Permission_Edit.stx 2010-06-05 18:43:44 UTC (rev 113164)
+++ Zope/trunk/src/Products/OFSP/help/Zope-Permission_Edit.stx 2010-06-05 19:07:49 UTC (rev 113165)
@@ -1,15 +0,0 @@
-Zope Permission - Edit: Edit Permission.
-
- Description
-
- This view allows you to edit Zope Permission settings.
-
- Controls
-
- 'Title' -- The optional title of the Zope Permission.
-
- 'Name' -- The name of the permission.
- **Note: A permission's name must be unique.**
-
- 'Change' -- Change the Permission.
-
More information about the Zope-Checkins
mailing list