From 175d43ad1854db74c998d02f384e38af6ccd71c6 Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Tue, 15 Oct 2013 15:01:52 +0200 Subject: [PATCH] call InitializeClass to apply security declaration in mixins. --- product/ERP5/mixin/amount_generator.py | 3 +++ product/ERP5/mixin/base_convertable.py | 3 +++ product/ERP5/mixin/builder.py | 2 ++ product/ERP5/mixin/cached_convertable.py | 4 +++- product/ERP5/mixin/composition.py | 3 +++ product/ERP5/mixin/configurable.py | 3 +++ product/ERP5/mixin/crawlable.py | 3 +++ product/ERP5/mixin/discoverable.py | 3 +++ product/ERP5/mixin/document.py | 3 +++ product/ERP5/mixin/document_proxy.py | 3 +++ product/ERP5/mixin/downloadable.py | 3 +++ product/ERP5/mixin/encrypted_password.py | 3 +++ product/ERP5/mixin/equivalence_tester.py | 3 +++ product/ERP5/mixin/explainable.py | 3 +++ product/ERP5/mixin/extensible_traversable.py | 4 +++- product/ERP5/mixin/login_account_provider.py | 3 +++ product/ERP5/mixin/movement_collection_updater.py | 3 +++ product/ERP5/mixin/periodicity.py | 3 +++ product/ERP5/mixin/property_recordable.py | 3 +++ product/ERP5/mixin/rule.py | 3 +++ product/ERP5/mixin/solver.py | 3 +++ product/ERP5/mixin/text_convertable.py | 3 +++ product/ERP5/mixin/timer_service.py | 3 +++ product/ERP5/mixin/url.py | 3 +++ product/ERP5/mixin/variated.py | 3 +++ product/ERP5/mixin/virtual_folder.py | 3 +++ 26 files changed, 77 insertions(+), 2 deletions(-) diff --git a/product/ERP5/mixin/amount_generator.py b/product/ERP5/mixin/amount_generator.py index 7b003160d9..ce54617724 100644 --- a/product/ERP5/mixin/amount_generator.py +++ b/product/ERP5/mixin/amount_generator.py @@ -30,6 +30,7 @@ from collections import defaultdict, deque import random import zope.interface from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Acquisition import aq_base, Implicit from Products.ERP5.AggregatedAmountList import AggregatedAmountList from Products.ERP5Type import Permissions, interfaces @@ -541,3 +542,5 @@ class AmountGeneratorMixin: % (x.getResourceTitle(), x.getQuantity(), x.getPrice()) for x in result_list)) return result_list + +InitializeClass(AmountGeneratorMixin) diff --git a/product/ERP5/mixin/base_convertable.py b/product/ERP5/mixin/base_convertable.py index b585fec5a9..264905cc41 100644 --- a/product/ERP5/mixin/base_convertable.py +++ b/product/ERP5/mixin/base_convertable.py @@ -28,6 +28,7 @@ ############################################################################## from Products.CMFCore.utils import getToolByName from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Products.ERP5Type import Permissions from OFS.Image import Pdata from cStringIO import StringIO @@ -98,3 +99,5 @@ class BaseConvertableFileMixin: file = StringIO(data) data, size = self._read_data(file) self._baseSetBaseData(data) + +InitializeClass(BaseConvertableFileMixin) diff --git a/product/ERP5/mixin/builder.py b/product/ERP5/mixin/builder.py index 57efe507a1..e166b55467 100644 --- a/product/ERP5/mixin/builder.py +++ b/product/ERP5/mixin/builder.py @@ -28,6 +28,7 @@ ############################################################################## from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.Core.Predicate import Predicate @@ -816,3 +817,4 @@ class BuilderMixin(XMLObject, Amount, Predicate): _deliveryLineGroupProcessing = _processDeliveryLineGroup _deliveryCellGroupProcessing = _processDeliveryCellGroup +InitializeClass(BuilderMixin) diff --git a/product/ERP5/mixin/cached_convertable.py b/product/ERP5/mixin/cached_convertable.py index b4e45d1171..efb5ea7a11 100644 --- a/product/ERP5/mixin/cached_convertable.py +++ b/product/ERP5/mixin/cached_convertable.py @@ -33,8 +33,8 @@ import string from Acquisition import aq_base from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Products.ERP5Type import Permissions -from Products.ERP5Type.Cache import DEFAULT_CACHE_SCOPE from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from OFS.Image import Pdata, Image as OFSImage from DateTime import DateTime @@ -293,3 +293,5 @@ class CachedConvertableMixin: into the specified target format. """ return format in self.getTargetFormatList() + +InitializeClass(CachedConvertableMixin) diff --git a/product/ERP5/mixin/composition.py b/product/ERP5/mixin/composition.py index 20db0ab13c..517fc51a56 100644 --- a/product/ERP5/mixin/composition.py +++ b/product/ERP5/mixin/composition.py @@ -28,6 +28,7 @@ ############################################################################## from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Acquisition import aq_base from Products.ERP5Type import Permissions from Products.ERP5Type.Cache import transactional_cached @@ -256,3 +257,5 @@ class CompositionMixin: return specialise_list del asComposedDocument # to be unhidden (and renamed ?) if needed + +InitializeClass(CompositionMixin) diff --git a/product/ERP5/mixin/configurable.py b/product/ERP5/mixin/configurable.py index b2de53ab82..c5f609546a 100644 --- a/product/ERP5/mixin/configurable.py +++ b/product/ERP5/mixin/configurable.py @@ -28,6 +28,7 @@ import zope.interface from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Acquisition import aq_base from Products.ERP5Type import Permissions, interfaces from Products.ERP5Type.Globals import PersistentMapping @@ -80,3 +81,5 @@ class ConfigurableMixin: if getattr(aq_base(self), '_configuration_property_dict', None) is None: self._configuration_property_dict = PersistentMapping() return self._configuration_property_dict + +InitializeClass(ConfigurableMixin) diff --git a/product/ERP5/mixin/crawlable.py b/product/ERP5/mixin/crawlable.py index 99a95bff1d..b7d0d02a9f 100644 --- a/product/ERP5/mixin/crawlable.py +++ b/product/ERP5/mixin/crawlable.py @@ -28,6 +28,7 @@ ############################################################################## from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Products.ERP5Type import Permissions from Products.ERP5Type.Utils import normaliseUrl from Products.ERP5Type.DateUtils import convertDateToHour,\ @@ -163,3 +164,5 @@ class CrawlableMixin: # if domain is empty (relative link) or domain is same, then OK url_list.append(url) return url_list + +InitializeClass(CrawlableMixin) diff --git a/product/ERP5/mixin/discoverable.py b/product/ERP5/mixin/discoverable.py index edc945feeb..0f7e4f082f 100644 --- a/product/ERP5/mixin/discoverable.py +++ b/product/ERP5/mixin/discoverable.py @@ -28,6 +28,7 @@ ############################################################################## from AccessControl import ClassSecurityInfo, getSecurityManager +from AccessControl.class_init import InitializeClass from ZODB.POSException import ConflictError from Products.ERP5Type import Permissions from Products.ERP5Type.Utils import convertToUpperCase @@ -274,3 +275,5 @@ class DiscoverableMixin(CachedConvertableMixin): if title_list: result['title'] = title_list[0] return result + +InitializeClass(DiscoverableMixin) diff --git a/product/ERP5/mixin/document.py b/product/ERP5/mixin/document.py index 58325cc9ab..297bd05dde 100644 --- a/product/ERP5/mixin/document.py +++ b/product/ERP5/mixin/document.py @@ -28,6 +28,7 @@ ############################################################################## from Products.CMFCore.utils import getToolByName from AccessControl import ClassSecurityInfo, Unauthorized +from AccessControl.class_init import InitializeClass from Products.ERP5Type import Permissions from OFS.Image import Pdata from cStringIO import StringIO @@ -144,3 +145,5 @@ class DocumentMixin: By default it doens't """ return False + +InitializeClass(DocumentMixin) diff --git a/product/ERP5/mixin/document_proxy.py b/product/ERP5/mixin/document_proxy.py index a21d00b9ad..e529a4d7ff 100644 --- a/product/ERP5/mixin/document_proxy.py +++ b/product/ERP5/mixin/document_proxy.py @@ -28,6 +28,7 @@ ############################################################################## from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Products.ERP5Type import Permissions from warnings import warn @@ -67,3 +68,5 @@ class DocumentProxyMixin: if proxied_document is None: raise DocumentProxyError("Unable to find a proxied document") return proxied_document + +InitializeClass(DocumentProxyMixin) diff --git a/product/ERP5/mixin/downloadable.py b/product/ERP5/mixin/downloadable.py index 9f97426db6..a4d6038ed9 100644 --- a/product/ERP5/mixin/downloadable.py +++ b/product/ERP5/mixin/downloadable.py @@ -27,6 +27,7 @@ # ############################################################################## from AccessControl import ClassSecurityInfo, Unauthorized +from AccessControl.class_init import InitializeClass from Products.ERP5Type import Permissions from Products.ERP5Type.Utils import fill_args_from_request from Products.CMFCore.utils import getToolByName, _checkConditionalGET, _setCacheHeaders,\ @@ -165,3 +166,5 @@ class DownloadableMixin: # pass format argument to force downloading raw content REQUEST = self.REQUEST return self.index_html(REQUEST, REQUEST.RESPONSE, format=None) + +InitializeClass(DownloadableMixin) diff --git a/product/ERP5/mixin/encrypted_password.py b/product/ERP5/mixin/encrypted_password.py index 26657040a5..9a8754c6a4 100644 --- a/product/ERP5/mixin/encrypted_password.py +++ b/product/ERP5/mixin/encrypted_password.py @@ -31,6 +31,7 @@ import zope.interface from AccessControl import ClassSecurityInfo from AccessControl.AuthEncoding import pw_encrypt, pw_validate +from AccessControl.class_init import InitializeClass from Acquisition import aq_base from Products.ERP5Type import Permissions, interfaces from Products.ERP5Type.Globals import PersistentMapping @@ -125,3 +126,5 @@ class EncryptedPasswordMixin: if format != 'default': password = default_password return password + +InitializeClass(EncryptedPasswordMixin) diff --git a/product/ERP5/mixin/equivalence_tester.py b/product/ERP5/mixin/equivalence_tester.py index 6ef0c3c691..911e0ec0d0 100644 --- a/product/ERP5/mixin/equivalence_tester.py +++ b/product/ERP5/mixin/equivalence_tester.py @@ -28,6 +28,7 @@ import zope.interface from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Products.ERP5Type import Permissions, interfaces from Products.ERP5Type.DivergenceMessage import DivergenceMessage from Products.ERP5Type.Message import Message @@ -212,3 +213,5 @@ class EquivalenceTesterMixin: tested_property = self.getTestedProperty() return {tested_property: self._getTestedPropertyValue(prevision_movement, tested_property)} + +InitializeClass(EquivalenceTesterMixin) diff --git a/product/ERP5/mixin/explainable.py b/product/ERP5/mixin/explainable.py index b927d1d59f..ecf5abf4f0 100644 --- a/product/ERP5/mixin/explainable.py +++ b/product/ERP5/mixin/explainable.py @@ -28,6 +28,7 @@ import zope.interface from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Products.ERP5Type import Permissions, interfaces class ExplainableMixin: @@ -143,3 +144,5 @@ class ExplainableMixin: """Returns the UID of the root explanation """ return self.getRootExplanationValue().getUid() + +InitializeClass(ExplainableMixin) diff --git a/product/ERP5/mixin/extensible_traversable.py b/product/ERP5/mixin/extensible_traversable.py index 542c1d7677..4886ba831d 100644 --- a/product/ERP5/mixin/extensible_traversable.py +++ b/product/ERP5/mixin/extensible_traversable.py @@ -35,6 +35,7 @@ from Products.ERP5Type.ExtensibleTraversable import ExtensibleTraversableMixIn from Products.ERP5Type.Cache import getReadOnlyTransactionCache from AccessControl import ClassSecurityInfo, getSecurityManager from AccessControl.SecurityManagement import newSecurityManager, setSecurityManager +from AccessControl.class_init import InitializeClass from Products.ERP5Type import Permissions from Products.CMFCore.utils import getToolByName, _checkConditionalGET, _setCacheHeaders, _ViewEmulator from OFS.Image import File as OFSFile @@ -169,6 +170,8 @@ class BaseExtensibleTraversableMixin(ExtensibleTraversableMixIn): if document is not None: return document.__of__(self) +InitializeClass(BaseExtensibleTraversableMixin) + class DocumentExtensibleTraversableMixin(BaseExtensibleTraversableMixin): """ This class provides a implementation of IExtensibleTraversable for Document classed based documents. @@ -226,4 +229,3 @@ class OOoDocumentExtensibleTraversableMixin(BaseExtensibleTraversableMixin): if user is not None: setSecurityManager(old_manager) return document - diff --git a/product/ERP5/mixin/login_account_provider.py b/product/ERP5/mixin/login_account_provider.py index feb9911fc2..a52fb574d3 100644 --- a/product/ERP5/mixin/login_account_provider.py +++ b/product/ERP5/mixin/login_account_provider.py @@ -30,6 +30,7 @@ from Products.ERP5Type import Permissions from AccessControl.AuthEncoding import pw_validate from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass class LoginAccountProviderMixin: """ @@ -113,3 +114,5 @@ class LoginAccountProviderMixin: if pw_validate(encoded_password, password): return True return False + +InitializeClass(LoginAccountProviderMixin) diff --git a/product/ERP5/mixin/movement_collection_updater.py b/product/ERP5/mixin/movement_collection_updater.py index e9af214041..d9b3ed36fa 100644 --- a/product/ERP5/mixin/movement_collection_updater.py +++ b/product/ERP5/mixin/movement_collection_updater.py @@ -28,6 +28,7 @@ import zope.interface from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Products.ERP5Type import Permissions, interfaces from Products.ERP5.MovementCollectionDiff import ( MovementCollectionDiff, _getPropertyAndCategoryList) @@ -187,3 +188,5 @@ class MovementCollectionUpdaterMixin: # Force update of local indexes on linked objects # (important for 'delivery'). movement._setCategoryList(categories) + +InitializeClass(MovementCollectionUpdaterMixin) diff --git a/product/ERP5/mixin/periodicity.py b/product/ERP5/mixin/periodicity.py index 2978fa84cc..7a08fcf1f3 100644 --- a/product/ERP5/mixin/periodicity.py +++ b/product/ERP5/mixin/periodicity.py @@ -29,6 +29,7 @@ from DateTime import DateTime from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Products.ERP5Type import Permissions from Products.ERP5Type.Message import Message @@ -258,3 +259,5 @@ class PeriodicityMixin: if day in day_list: new_list += [day] return new_list + +InitializeClass(PeriodicityMixin) diff --git a/product/ERP5/mixin/property_recordable.py b/product/ERP5/mixin/property_recordable.py index c87f8dd90a..6694d246d5 100644 --- a/product/ERP5/mixin/property_recordable.py +++ b/product/ERP5/mixin/property_recordable.py @@ -28,6 +28,7 @@ import zope.interface from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Acquisition import aq_base from Products.ERP5Type import Permissions, interfaces from Products.ERP5Type.Globals import PersistentMapping @@ -130,3 +131,5 @@ class PropertyRecordableMixin: def _getRecordedPropertyDict(self, *args): return getattr(aq_base(self), '_recorded_property_dict', *args) + +InitializeClass(PropertyRecordableMixin) diff --git a/product/ERP5/mixin/rule.py b/product/ERP5/mixin/rule.py index ae9627d9b4..b8c4e6be1a 100644 --- a/product/ERP5/mixin/rule.py +++ b/product/ERP5/mixin/rule.py @@ -29,6 +29,7 @@ import transaction import zope.interface from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Acquisition import aq_base from Products.ERP5Type import Permissions, interfaces from Products.ERP5Type.Base import Base @@ -607,3 +608,5 @@ class SimulableMixin(Base): for o in self.getCausalityRelatedValueList(portal_type='Applied Rule'): o.getParentValue().deleteContent(o.getId()) super(SimulableMixin, self).manage_beforeDelete(item, container) + +InitializeClass(RuleMixin) diff --git a/product/ERP5/mixin/solver.py b/product/ERP5/mixin/solver.py index a5eeb03783..6476d0e24e 100644 --- a/product/ERP5/mixin/solver.py +++ b/product/ERP5/mixin/solver.py @@ -29,6 +29,7 @@ import zope.interface from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type.UnrestrictedMethod import super_user from Products.ERP5Type.XMLObject import XMLObject @@ -116,3 +117,5 @@ class ConfigurablePropertySolverMixin(SolverMixin, portal_type = self.getPortalObject().portal_types.getTypeInfo(self) tested_property_list = portal_type.getTestedPropertyList() return tested_property_list + +InitializeClass(SolverMixin) diff --git a/product/ERP5/mixin/text_convertable.py b/product/ERP5/mixin/text_convertable.py index d017a1a544..c106f7dc7f 100644 --- a/product/ERP5/mixin/text_convertable.py +++ b/product/ERP5/mixin/text_convertable.py @@ -28,6 +28,7 @@ ############################################################################## from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Products.ERP5Type import Permissions from warnings import warn @@ -69,3 +70,5 @@ class TextConvertableMixin: warn("asTextContent() function is deprecated. Use asText() instead.", \ DeprecationWarning, stacklevel=2) return self.asText(**kw) + +InitializeClass(TextConvertableMixin) diff --git a/product/ERP5/mixin/timer_service.py b/product/ERP5/mixin/timer_service.py index c4a71bfab5..81e19da09e 100644 --- a/product/ERP5/mixin/timer_service.py +++ b/product/ERP5/mixin/timer_service.py @@ -28,6 +28,7 @@ import warnings from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Products.CMFActivity.ActivityTool import ActivityTool from Products.ERP5Type import Permissions try: @@ -84,3 +85,5 @@ class TimerServiceMixin(object): getServerAddress = ActivityTool.getServerAddress.im_func _isValidNodeName = ActivityTool._isValidNodeName.im_func + +InitializeClass(TimerServiceMixin) diff --git a/product/ERP5/mixin/url.py b/product/ERP5/mixin/url.py index 5152e39905..6ab2995797 100644 --- a/product/ERP5/mixin/url.py +++ b/product/ERP5/mixin/url.py @@ -28,6 +28,7 @@ ############################################################################## from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Products.ERP5Type import Permissions from Products.ERP5Type.Utils import normaliseUrl @@ -138,3 +139,5 @@ class UrlMixin: """ if self.hasUrlString(): return normaliseUrl(self.asURL(), base_url=base_url) + +InitializeClass(UrlMixin) diff --git a/product/ERP5/mixin/variated.py b/product/ERP5/mixin/variated.py index e537aab9de..51361f707c 100644 --- a/product/ERP5/mixin/variated.py +++ b/product/ERP5/mixin/variated.py @@ -29,6 +29,7 @@ from warnings import warn from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Products.CMFCategory.Renderer import Renderer from Products.ERP5Type import interfaces, Permissions, PropertySheet import zope.interface @@ -388,3 +389,5 @@ class VariatedMixin: category_list = list(self.getVariationCategoryList()) category_list.sort() return '\n'.join(category_list) + +InitializeClass(VariatedMixin) diff --git a/product/ERP5/mixin/virtual_folder.py b/product/ERP5/mixin/virtual_folder.py index 26f7ec048b..535237ff23 100644 --- a/product/ERP5/mixin/virtual_folder.py +++ b/product/ERP5/mixin/virtual_folder.py @@ -31,6 +31,7 @@ _marker=[] from AccessControl import ClassSecurityInfo +from AccessControl.class_init import InitializeClass from Products.ERP5Type.Core.Folder import Folder from Products.ERP5Type.TransactionalVariable import getTransactionalVariable @@ -89,3 +90,5 @@ class VirtualFolderMixin: if default is _marker: raise return default + +InitializeClass(VirtualFolderMixin) -- 2.30.9