Commit 175d43ad authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

call InitializeClass to apply security declaration in mixins.

parent fd1a7c2b
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
......@@ -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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment