[CMF-checkins] CVS: CMF/CMFCore - ActionsTool.py:1.33 CatalogTool.py:1.35 CookieCrumbler.py:1.15 DirectoryView.py:1.25 DiscussionTool.py:1.8 FSDTMLMethod.py:1.11 FSObject.py:1.11 FSPageTemplate.py:1.11 FSPropertiesObject.py:1.14 FSPythonScript.py:1.18 FSSTXMethod.py:1.7 MemberDataTool.py:1.18 MembershipTool.py:1.26 PortalContent.py:1.39 PortalFolder.py:1.42 RegistrationTool.py:1.15 SkinsTool.py:1.17 TypesTool.py:1.43 UndoTool.py:1.10 utils.py:1.26
Florent Guillaume
fg@nuxeo.com
Sat, 3 Aug 2002 22:32:32 -0400
Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv17343/CMFCore
Modified Files:
ActionsTool.py CatalogTool.py CookieCrumbler.py
DirectoryView.py DiscussionTool.py FSDTMLMethod.py FSObject.py
FSPageTemplate.py FSPropertiesObject.py FSPythonScript.py
FSSTXMethod.py MemberDataTool.py MembershipTool.py
PortalContent.py PortalFolder.py RegistrationTool.py
SkinsTool.py TypesTool.py UndoTool.py utils.py
Log Message:
Pure stylistic and code formatting changes:
- Cleanup CMFCorePermissions imports.
- Always put security.declareProtected and friends on a single line
and just in front of the definition they're protecting, so that
automated coherency checking can be done using simple tools like
grep.
=== CMF/CMFCore/ActionsTool.py 1.32 => 1.33 ===
import OFS
from utils import UniqueObject, SimpleItemWithProperties, _getAuthenticatedUser, _checkPermission
from utils import getToolByName, _dtmldir, cookString
-import CMFCorePermissions
+from CMFCorePermissions import ManagePortal
from OFS.SimpleItem import SimpleItem
from Globals import InitializeClass, DTMLFile, package_home
from urllib import quote
@@ -80,8 +80,7 @@
#
# ZMI methods
#
- security.declareProtected( CMFCorePermissions.ManagePortal
- , 'manage_overview' )
+ security.declareProtected(ManagePortal, 'manage_overview')
manage_overview = DTMLFile( 'explainActionsTool', _dtmldir )
manage_actionProviders = DTMLFile('manageActionProviders', _dtmldir)
@@ -97,15 +96,12 @@
"""
return self._actions
- security.declareProtected( CMFCorePermissions.ManagePortal
- , 'listActionProviders'
- )
+ security.declareProtected(ManagePortal, 'listActionProviders')
def listActionProviders(self):
""" returns a sequence of action providers known by this tool """
return self.action_providers
- security.declareProtected(CMFCorePermissions.ManagePortal
- , 'manage_aproviders')
+ security.declareProtected(ManagePortal, 'manage_aproviders')
def manage_aproviders(self
, apname=''
, chosen=()
@@ -132,9 +128,7 @@
- security.declareProtected( CMFCorePermissions.ManagePortal
- , 'addActionProvider'
- )
+ security.declareProtected(ManagePortal, 'addActionProvider')
def addActionProvider( self, provider_name ):
""" add the name of a new action provider """
if hasattr( self, provider_name ):
@@ -142,9 +136,7 @@
p_new = p_old + ( provider_name, )
self.action_providers = p_new
- security.declareProtected( CMFCorePermissions.ManagePortal
- , 'deleteActionProvider'
- )
+ security.declareProtected(ManagePortal, 'deleteActionProvider')
def deleteActionProvider( self, provider_name ):
""" remove an action provider """
if provider_name in self.action_providers:
=== CMF/CMFCore/CatalogTool.py 1.34 => 1.35 ===
from ActionInformation import ActionInformation
from Expression import Expression
import os
-import CMFCorePermissions
+from CMFCorePermissions import ManagePortal
+from CMFCorePermissions import AccessInactivePortalContent
from Acquisition import aq_base
@@ -178,8 +179,7 @@
#
# ZMI methods
#
- security.declareProtected( CMFCorePermissions.ManagePortal
- , 'manage_overview' )
+ security.declareProtected(ManagePortal, 'manage_overview')
manage_overview = DTMLFile( 'explainCatalogTool', _dtmldir )
#
@@ -201,8 +201,7 @@
user = _getAuthenticatedUser(self)
kw[ 'allowedRolesAndUsers' ] = self._listAllowedRolesAndUsers( user )
- if not _checkPermission(
- CMFCorePermissions.AccessInactivePortalContent, self ):
+ if not _checkPermission( AccessInactivePortalContent, self ):
base = aq_base( self )
now = DateTime()
if hasattr( base, 'addIndex' ): # Zope 2.4 and above
=== CMF/CMFCore/CookieCrumbler.py 1.14 => 1.15 ===
from AccessControl import ClassSecurityInfo
from ZPublisher import BeforeTraverse
import Globals
-import CMFCorePermissions
+from CMFCorePermissions import ModifyCookieCrumblers
+from CMFCorePermissions import ViewManagementScreens
from Globals import HTMLFile
from zLOG import LOG, ERROR
import sys
@@ -44,11 +45,9 @@
meta_type = 'Cookie Crumbler'
security = ClassSecurityInfo()
- security.declareProtected(CMFCorePermissions.ModifyCookieCrumblers,
- 'manage_editProperties',
- 'manage_changeProperties')
- security.declareProtected(CMFCorePermissions.ViewManagementScreens,
- 'manage_propertiesForm')
+ security.declareProtected(ModifyCookieCrumblers, 'manage_editProperties')
+ security.declareProtected(ModifyCookieCrumblers, 'manage_changeProperties')
+ security.declareProtected(ViewManagementScreens, 'manage_propertiesForm')
_properties = ({'id':'auth_cookie', 'type': 'string', 'mode':'w',
=== CMF/CMFCore/DirectoryView.py 1.24 => 1.25 ===
from OFS.ObjectManager import bad_id
from OFS.Folder import Folder
from AccessControl import ClassSecurityInfo
-from CMFCorePermissions import AccessContentsInformation, ManagePortal
-import CMFCorePermissions
+from CMFCorePermissions import AccessContentsInformation
+from CMFCorePermissions import ManagePortal
from FSObject import BadFile
from utils import expandpath, minimalpath
from zLOG import LOG, ERROR
@@ -443,12 +443,10 @@
d[name] = value
setattr(d['_real'], name, value)
- security.declareProtected(ManagePortal,
- 'manage_propertiesForm')
+ security.declareProtected(ManagePortal, 'manage_propertiesForm')
manage_propertiesForm = DTMLFile( 'dirview_properties', _dtmldir )
- security.declareProtected(ManagePortal,
- 'manage_properties')
+ security.declareProtected(ManagePortal, 'manage_properties')
def manage_properties( self, dirpath, REQUEST=None ):
"""
Update the directory path of the DV.
@@ -458,16 +456,14 @@
REQUEST['RESPONSE'].redirect( '%s/manage_propertiesForm'
% self.absolute_url() )
- security.declareProtected(AccessContentsInformation,
- 'getCustomizableObject')
+ security.declareProtected(AccessContentsInformation, 'getCustomizableObject')
def getCustomizableObject(self):
ob = aq_parent(aq_inner(self))
while getattr(ob, '_isDirectoryView', 0):
ob = aq_parent(aq_inner(ob))
return ob
- security.declareProtected(AccessContentsInformation,
- 'listCustFolderPaths')
+ security.declareProtected(AccessContentsInformation, 'listCustFolderPaths')
def listCustFolderPaths(self, adding_meta_type=None):
'''
Returns a list of possible customization folders
@@ -479,8 +475,7 @@
rval.sort()
return rval
- security.declareProtected(AccessContentsInformation,
- 'getDirPath')
+ security.declareProtected(AccessContentsInformation, 'getDirPath')
def getDirPath(self):
return self.__dict__['_real']._dirpath
=== CMF/CMFCore/DiscussionTool.py 1.7 => 1.8 ===
from utils import UniqueObject, getToolByName
from utils import getToolByName, _dtmldir
-import CMFCorePermissions
+from CMFCorePermissions import ReplyToItem
+from CMFCorePermissions import View
+from CMFCorePermissions import AccessContentsInformation
+from CMFCorePermissions import ManagePortal
from OFS.SimpleItem import SimpleItem
from Globals import InitializeClass, DTMLFile
import Acquisition
@@ -37,7 +40,7 @@
def __init__( self, content ):
self.content = content
- security.declareProtected(CMFCorePermissions.ReplyToItem, 'createReply')
+ security.declareProtected(ReplyToItem, 'createReply')
def createReply(self, title, text, REQUEST, RESPONSE):
"""
Create a reply in the proper place
@@ -58,9 +61,8 @@
if not hasattr(home, 'Correspondence'):
home.manage_addPortalFolder('Correspondence')
location = home.Correspondence
- location.manage_permission(CMFCorePermissions.View, ['Anonymous'], 1)
- location.manage_permission(
- CMFCorePermissions.AccessContentsInformation, ['Anonymous'], 1)
+ location.manage_permission(View, ['Anonymous'], 1)
+ location.manage_permission(AccessContentsInformation, ['Anonymous'], 1)
# Find an unused id in location
id = int(DateTime().timeTime())
@@ -69,7 +71,7 @@
return location, `id`
- security.declareProtected(CMFCorePermissions.View, 'getReplyResults')
+ security.declareProtected(View, 'getReplyResults')
def getReplyResults(self):
"""
Return the ZCatalog results that represent this object's replies.
@@ -81,7 +83,7 @@
return catalog.searchResults(in_reply_to=
urllib.unquote('/'+self.absolute_url(1)))
- security.declareProtected(CMFCorePermissions.View, 'getReplies')
+ security.declareProtected(View, 'getReplies')
def getReplies(self):
"""
Return a sequence of the DiscussionResponse objects which are
@@ -116,8 +118,7 @@
#
# ZMI methods
#
- security.declareProtected( CMFCorePermissions.ManagePortal
- , 'manage_overview' )
+ security.declareProtected(ManagePortal, 'manage_overview')
manage_overview = DTMLFile( 'explainDiscussionTool', _dtmldir )
#
=== CMF/CMFCore/FSDTMLMethod.py 1.10 => 1.11 ===
from OFS.DTMLMethod import DTMLMethod, decapitate, guess_content_type
from utils import _dtmldir
-from CMFCorePermissions import View, ViewManagementScreens, FTPAccess
+from CMFCorePermissions import View
+from CMFCorePermissions import ViewManagementScreens
+from CMFCorePermissions import FTPAccess
from DirectoryView import registerFileExtension, registerMetaType, expandpath
from FSObject import FSObject
try:
@@ -130,11 +132,12 @@
return getSecurityManager().validate(inst, parent, name, value)
security.declareProtected(FTPAccess, 'manage_FTPget')
- security.declareProtected(ViewManagementScreens, 'PrincipiaSearchSource',
- 'document_src')
-
manage_FTPget = DTMLMethod.manage_FTPget
+
+ security.declareProtected(ViewManagementScreens, 'PrincipiaSearchSource')
PrincipiaSearchSource = DTMLMethod.PrincipiaSearchSource
+
+ security.declareProtected(ViewManagementScreens, 'document_src')
document_src = DTMLMethod.document_src
Globals.InitializeClass(FSDTMLMethod)
=== CMF/CMFCore/FSObject.py 1.10 => 1.11 ===
from DateTime import DateTime
from utils import expandpath, getToolByName
-import CMFCorePermissions
+from CMFCorePermissions import View
+from CMFCorePermissions import ViewManagementScreens
+from CMFCorePermissions import ManagePortal
class FSObject(Acquisition.Implicit, Item):
"""FSObject is a base class for all filesystem based look-alikes.
@@ -38,7 +40,7 @@
title = ''
security = ClassSecurityInfo()
- security.declareObjectProtected(CMFCorePermissions.View)
+ security.declareObjectProtected(View)
_file_mod_time = 0
_parsed = 0
@@ -60,8 +62,7 @@
except: pass
self._readFile(0)
- security.declareProtected(CMFCorePermissions.ViewManagementScreens,
- 'manage_doCustomize')
+ security.declareProtected(ViewManagementScreens, 'manage_doCustomize')
def manage_doCustomize(self, folder_path, RESPONSE=None):
"""Makes a ZODB Based clone with the same data.
@@ -107,13 +108,13 @@
self._file_mod_time = mtime
self._readFile(1)
- security.declareProtected(CMFCorePermissions.View, 'get_size')
+ security.declareProtected(View, 'get_size')
def get_size(self):
"""Get the size of the underlying file."""
fp = expandpath(self._filepath)
return path.getsize(fp)
- security.declareProtected(CMFCorePermissions.View, 'getModTime')
+ security.declareProtected(View, 'getModTime')
def getModTime(self):
"""Return the last_modified date of the file we represent.
@@ -122,8 +123,7 @@
self._updateFromFS()
return DateTime(self._file_mod_time)
- security.declareProtected(CMFCorePermissions.ViewManagementScreens,
- 'getObjectFSPath')
+ security.declareProtected(ViewManagementScreens, 'getObjectFSPath')
def getObjectFSPath(self):
"""Return the path of the file we represent"""
self._updateFromFS()
@@ -170,8 +170,7 @@
security = ClassSecurityInfo()
showError = Globals.HTML( BAD_FILE_VIEW )
- security.declareProtected( CMFCorePermissions.ManagePortal
- , 'manage_showError' )
+ security.declareProtected(ManagePortal, 'manage_showError')
def manage_showError( self, REQUEST ):
"""
"""
=== CMF/CMFCore/FSPageTemplate.py 1.10 => 1.11 ===
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate, Src
from DirectoryView import registerFileExtension, registerMetaType, expandpath
-from CMFCorePermissions import ViewManagementScreens, View, FTPAccess
+from CMFCorePermissions import ViewManagementScreens
+from CMFCorePermissions import View
+from CMFCorePermissions import FTPAccess
from FSObject import FSObject
from utils import getToolByName
@@ -167,17 +169,21 @@
# Copy over more methods
security.declareProtected(FTPAccess, 'manage_FTPget')
- security.declareProtected(View, 'get_size')
- security.declareProtected(ViewManagementScreens, 'PrincipiaSearchSource',
- 'document_src')
-
- pt_getContext = ZopePageTemplate.pt_getContext
- ZScriptHTML_tryParams = ZopePageTemplate.ZScriptHTML_tryParams
manage_FTPget = ZopePageTemplate.manage_FTPget
+
+ security.declareProtected(View, 'get_size')
get_size = ZopePageTemplate.get_size
getSize = get_size
+
+ security.declareProtected(ViewManagementScreens, 'PrincipiaSearchSource')
PrincipiaSearchSource = ZopePageTemplate.PrincipiaSearchSource
+
+ security.declareProtected(ViewManagementScreens, 'document_src')
document_src = ZopePageTemplate.document_src
+
+ pt_getContext = ZopePageTemplate.pt_getContext
+
+ ZScriptHTML_tryParams = ZopePageTemplate.ZScriptHTML_tryParams
d = FSPageTemplate.__dict__
=== CMF/CMFCore/FSPropertiesObject.py 1.13 => 1.14 ===
manage_main = Globals.DTMLFile('custprops', _dtmldir)
# Declare all (inherited) mutating methods private.
- security.declarePrivate('manage_addProperty',
- 'manage_editProperties',
- 'manage_delProperties',
- 'manage_changeProperties',
- 'manage_propertiesForm',
- 'manage_propertyTypeForm',
- 'manage_changePropertyTypes',)
-
+ security.declarePrivate('manage_addProperty')
+ security.declarePrivate('manage_editProperties')
+ security.declarePrivate('manage_delProperties')
+ security.declarePrivate('manage_changeProperties')
+ security.declarePrivate('manage_propertiesForm')
+ security.declarePrivate('manage_propertyTypeForm')
+ security.declarePrivate('manage_changePropertyTypes')
+
security.declareProtected(ViewManagementScreens, 'manage_doCustomize')
def manage_doCustomize(self, folder_path, RESPONSE=None):
"""Makes a ZODB Based clone with the same data.
=== CMF/CMFCore/FSPythonScript.py 1.17 => 1.18 ===
finally:
security.removeContext(self)
- security.declareProtected(ViewManagementScreens,
- 'read', 'getModTime', 'get_size',
- 'ZScriptHTML_tryForm', 'PrincipiaSearchSource',
- 'document_src', 'params', 'body')
+ security.declareProtected(ViewManagementScreens, 'getModTime')
+ # getModTime defined in FSObject
+
+ security.declareProtected(ViewManagementScreens, 'ZScriptHTML_tryForm')
+ # ZScriptHTML_tryForm defined in Shared.DC.Scripts.Script.Script
def ZScriptHTML_tryParams(self):
"""Parameters to test the script with."""
@@ -140,10 +141,12 @@
param_names.append(split(name, '=', 1)[0])
return param_names
+ security.declareProtected(ViewManagementScreens, 'read')
def read(self):
self._updateFromFS()
return self._source
-
+
+ security.declareProtected(ViewManagementScreens, 'document_src')
def document_src(self, REQUEST=None, RESPONSE=None):
"""Return unprocessed document source."""
@@ -151,12 +154,18 @@
RESPONSE.setHeader('Content-Type', 'text/plain')
return self._source
+ security.declareProtected(ViewManagementScreens, 'PrincipiaSearchSource')
def PrincipiaSearchSource(self):
"Support for searching - the document's contents are searched."
return "%s\n%s" % (self._params, self._body)
+ security.declareProtected(ViewManagementScreens, 'params')
def params(self): return self._params
+
+ security.declareProtected(ViewManagementScreens, 'body')
def body(self): return self._body
+
+ security.declareProtected(ViewManagementScreens, 'get_size')
def get_size(self): return len(self.read())
security.declareProtected(FTPAccess, 'manage_FTPget')
=== CMF/CMFCore/FSSTXMethod.py 1.6 => 1.7 ===
"""
return self.raw
- security.declareProtected( ViewManagementScreens
- , 'PrincipiaSearchSource' )
+ security.declareProtected( ViewManagementScreens, 'PrincipiaSearchSource' )
def PrincipiaSearchSource( self ):
"""
Fetch our source for indexing in a catalog.
"""
return self.raw
- security.declareProtected( ViewManagementScreens
- , 'document_src' )
+ security.declareProtected( ViewManagementScreens, 'document_src' )
def document_src( self ):
"""
Fetch our source for indexing in a catalog.
=== CMF/CMFCore/MemberDataTool.py 1.17 => 1.18 ===
from Acquisition import aq_inner, aq_parent, aq_base
from AccessControl import ClassSecurityInfo
from CMFCorePermissions import ViewManagementScreens
-import CMFCorePermissions
+from CMFCorePermissions import ManagePortal
+from CMFCorePermissions import SetOwnProperties
from ActionProviderBase import ActionProviderBase
_marker = [] # Create a new marker object.
@@ -60,17 +61,12 @@
#
# ZMI methods
#
- security.declareProtected( CMFCorePermissions.ManagePortal
- , 'manage_overview' )
+ security.declareProtected(ManagePortal, 'manage_overview')
manage_overview = DTMLFile( 'explainMemberDataTool', _dtmldir )
- security.declareProtected( CMFCorePermissions.ViewManagementScreens
- , 'manage_showContents')
+ security.declareProtected(ViewManagementScreens, 'manage_showContents')
manage_showContents = DTMLFile('memberdataContents', _dtmldir )
- security.declareProtected( CMFCorePermissions.ViewManagementScreens
- , 'getContentsInformation',)
-
def __init__(self):
self._members = OOBTree()
@@ -223,7 +219,7 @@
def getMemberId(self):
return self.getUser().getUserName()
- security.declareProtected(CMFCorePermissions.SetOwnProperties, 'setProperties')
+ security.declareProtected(SetOwnProperties, 'setProperties')
def setProperties(self, properties=None, **kw):
'''Allows the authenticated member to set his/her own properties.
Accepts either keyword arguments or a mapping for the "properties"
=== CMF/CMFCore/MembershipTool.py 1.25 => 1.26 ===
from Acquisition import aq_base
from AccessControl.User import nobody
from AccessControl import ClassSecurityInfo
+from CMFCorePermissions import View
+from CMFCorePermissions import AccessContentsInformation
from CMFCorePermissions import ManagePortal
-import CMFCorePermissions
+from CMFCorePermissions import SetOwnPassword
from ActionProviderBase import ActionProviderBase
default_member_content = '''Default page for %s
@@ -60,8 +62,7 @@
#
# ZMI methods
#
- security.declareProtected( CMFCorePermissions.ManagePortal
- , 'manage_overview' )
+ security.declareProtected(ManagePortal, 'manage_overview')
manage_overview = DTMLFile( 'explainMembershipTool', _dtmldir )
#
@@ -70,7 +71,7 @@
security.declareProtected(ManagePortal, 'manage_mapRoles')
manage_mapRoles = DTMLFile('membershipRolemapping', _dtmldir )
- security.declareProtected(CMFCorePermissions.SetOwnPassword, 'setPassword')
+ security.declareProtected(SetOwnPassword, 'setPassword')
def setPassword(self, password, domains=None):
'''Allows the authenticated member to set his/her own password.
'''
@@ -243,9 +244,9 @@
members.manage_addPortalFolder( id=member_id, title=f_title )
f=getattr(members, member_id)
- f.manage_permission(CMFCorePermissions.View,
+ f.manage_permission(View,
['Owner','Manager','Reviewer'], 0)
- f.manage_permission(CMFCorePermissions.AccessContentsInformation,
+ f.manage_permission(AccessContentsInformation,
['Owner','Manager','Reviewer'], 0)
# Grant ownership to Member
@@ -333,7 +334,7 @@
'''
return map(self.wrapUser, self.__getPUS().getUsers())
- security.declareProtected(CMFCorePermissions.View, 'searchMembers')
+ security.declareProtected(View, 'searchMembers')
def searchMembers( self, search_param, search_term ):
""" Search the membership """
md = getToolByName( self, 'portal_memberdata' )
@@ -341,7 +342,7 @@
return md.searchMemberDataContents( search_param, search_term )
- security.declareProtected(CMFCorePermissions.View, 'getCandidateLocalRoles')
+ security.declareProtected(View, 'getCandidateLocalRoles')
def getCandidateLocalRoles( self, obj ):
""" What local roles can I assign? """
member = self.getAuthenticatedMember()
@@ -354,7 +355,7 @@
return tuple( member_roles )
- security.declareProtected(CMFCorePermissions.View, 'setLocalRoles')
+ security.declareProtected(View, 'setLocalRoles')
def setLocalRoles( self, obj, member_ids, member_role, reindex=1 ):
""" Set local roles on an item """
member = self.getAuthenticatedMember()
@@ -374,7 +375,7 @@
# thus PortalContent and PortalFolder.
obj.reindexObjectSecurity()
- security.declareProtected(CMFCorePermissions.View, 'deleteLocalRoles')
+ security.declareProtected(View, 'deleteLocalRoles')
def deleteLocalRoles( self, obj, member_ids, reindex=1 ):
""" Delete local roles for members member_ids """
member = self.getAuthenticatedMember()
=== CMF/CMFCore/PortalContent.py 1.38 => 1.39 ===
# The security for FTP methods aren't set up by default in our
# superclasses... :(
- security.declareProtected(FTPAccess,
- 'manage_FTPstat',
- 'manage_FTPget',
- 'manage_FTPlist',)
+ security.declareProtected(FTPAccess, 'manage_FTPstat')
+ security.declareProtected(FTPAccess, 'manage_FTPget')
+ security.declareProtected(FTPAccess, 'manage_FTPlist')
def failIfLocked(self):
"""
=== CMF/CMFCore/PortalFolder.py 1.41 => 1.42 ===
import sys
import Globals, re, base64, marshal, string
-import CMFCorePermissions
-from CMFCorePermissions import View, ManageProperties, ListFolderContents
-from CMFCorePermissions import AddPortalFolders, AddPortalContent
+from CMFCorePermissions import View
+from CMFCorePermissions import ManageProperties
+from CMFCorePermissions import ListFolderContents
+from CMFCorePermissions import AddPortalFolders
+from CMFCorePermissions import AddPortalContent
from CMFCatalogAware import CMFCatalogAware
from OFS.Folder import Folder
from OFS.ObjectManager import REPLACEABLE
@@ -85,23 +87,21 @@
self.id = id
self.title = title
- security.declareProtected( CMFCorePermissions.ManageProperties
- , 'setTitle')
+ security.declareProtected(ManageProperties, 'setTitle')
def setTitle( self, title ):
"""
Edit the folder title.
"""
self.title = title
- security.declareProtected( CMFCorePermissions.ManageProperties
- , 'setDescription')
+ security.declareProtected(ManageProperties, 'setDescription')
def setDescription( self, description ):
"""
Edit the folder description.
"""
self.description = description
- security.declareProtected(CMFCorePermissions.ManageProperties, 'edit')
+ security.declareProtected(ManageProperties, 'edit')
def edit(self, title='', description=''):
"""
Edit the folder title (and possibly other attributes later)
@@ -223,8 +223,7 @@
return map( lambda item: item[1],
self._filteredItems( ids, filter ) )
- security.declareProtected( ListFolderContents
- , 'listFolderContents' )
+ security.declareProtected(ListFolderContents, 'listFolderContents')
def listFolderContents( self, spec=None, contentFilter=None ):
"""
Hook around 'contentValues' to let 'folder_contents'
=== CMF/CMFCore/RegistrationTool.py 1.14 => 1.15 ===
#
# ZMI methods
#
- security.declareProtected( ManagePortal
- , 'manage_overview' )
+ security.declareProtected(ManagePortal, 'manage_overview')
manage_overview = DTMLFile( 'explainRegistrationTool', _dtmldir )
#
=== CMF/CMFCore/SkinsTool.py 1.16 => 1.17 ===
from Acquisition import aq_base
from DateTime import DateTime
from AccessControl import ClassSecurityInfo
-from CMFCorePermissions import ManagePortal, AccessContentsInformation
+from CMFCorePermissions import ManagePortal
+from CMFCorePermissions import AccessContentsInformation
from ActionProviderBase import ActionProviderBase
from ActionInformation import ActionInformation
from Expression import Expression
@@ -40,8 +41,6 @@
except ImportError:
SUPPORTS_PAGE_TEMPLATES=0
-import CMFCorePermissions
-
def modifiedOptions():
# Remove the existing "Properties" option and add our own.
@@ -86,8 +85,7 @@
#
# ZMI methods
#
- security.declareProtected( CMFCorePermissions.ManagePortal
- , 'manage_overview' )
+ security.declareProtected(ManagePortal, 'manage_overview')
manage_overview = DTMLFile( 'explainSkinsTool', _dtmldir )
default_skin = ''
=== CMF/CMFCore/TypesTool.py 1.42 => 1.43 ===
import string
from AccessControl import getSecurityManager, ClassSecurityInfo, Unauthorized
from Acquisition import aq_base
-import Products, CMFCorePermissions
+import Products
from ActionProviderBase import ActionProviderBase
from ActionInformation import ActionInformation
from Expression import Expression
from zLOG import LOG, WARNING, ERROR
import sys
-from CMFCorePermissions import View, ManagePortal, AccessContentsInformation
+from CMFCorePermissions import View
+from CMFCorePermissions import ManagePortal
+from CMFCorePermissions import AccessContentsInformation
_marker = [] # Create a new marker.
@@ -46,11 +48,9 @@
security = ClassSecurityInfo()
- security.declareProtected(CMFCorePermissions.ManagePortal,
- 'manage_editProperties',
- 'manage_changeProperties',
- 'manage_propertiesForm',
- )
+ security.declareProtected(ManagePortal, 'manage_editProperties')
+ security.declareProtected(ManagePortal, 'manage_changeProperties')
+ security.declareProtected(ManagePortal, 'manage_propertiesForm')
_basic_properties = (
@@ -479,7 +479,7 @@
return default
security.declarePublic('isConstructionAllowed')
- def isConstructionAllowed ( self, container ):
+ def isConstructionAllowed( self, container ):
"""
a. Does the factory method exist?
@@ -614,8 +614,7 @@
#
# ZMI methods
#
- security.declareProtected( CMFCorePermissions.ManagePortal
- , 'manage_overview' )
+ security.declareProtected(ManagePortal, 'manage_overview')
manage_overview = DTMLFile( 'explainTypesTool', _dtmldir )
security.declarePrivate('listActions')
=== CMF/CMFCore/UndoTool.py 1.9 => 1.10 ===
from Expression import Expression
from ActionInformation import ActionInformation
from ActionProviderBase import ActionProviderBase
-from CMFCorePermissions import ManagePortal, UndoChanges, ListUndoableChanges
+from CMFCorePermissions import ManagePortal
+from CMFCorePermissions import ListUndoableChanges
class UndoTool (UniqueObject, SimpleItem, ActionProviderBase):
id = 'portal_undo'
@@ -52,8 +53,7 @@
#
# ZMI methods
#
- security.declareProtected( ManagePortal
- , 'manage_overview' )
+ security.declareProtected(ManagePortal, 'manage_overview')
manage_overview = DTMLFile( 'explainUndoTool', _dtmldir )
security.declarePrivate('listActions')
@@ -66,8 +66,7 @@
#
# 'portal_undo' interface methods
#
- security.declareProtected( ListUndoableChanges
- , 'listUndoableTransactionsFor')
+ security.declareProtected(ListUndoableChanges, 'listUndoableTransactionsFor')
def listUndoableTransactionsFor(self, object,
first_transaction=None,
last_transaction=None,
=== CMF/CMFCore/utils.py 1.25 => 1.26 ===
security = ModuleSecurityInfo( 'Products.CMFCore.utils' )
-security.declarePublic( 'getToolByName'
- , 'cookString'
- , 'tuplize'
- , 'format_stx'
- , 'keywordsplitter'
- , 'normalize'
- , 'expandpath'
- , 'minimalpath'
- )
-
-security.declarePrivate( '_getAuthenticatedUser'
- , '_checkPermission'
- , '_verifyActionPermissions'
- , '_getViewFor'
- , '_limitGrantedRoles'
- , '_mergedLocalRoles'
- , '_modifyPermissionMappings'
- , '_ac_inherited_permissions'
- )
-
_dtmldir = os_path.join( package_home( globals() ), 'dtml' )
@@ -78,6 +58,7 @@
#
_marker = [] # Create a new marker object.
+security.declarePublic('getToolByName')
def getToolByName(obj, name, default=_marker):
""" Get the tool, 'toolname', by acquiring it.
@@ -97,6 +78,7 @@
raise AttributeError, name
return tool
+security.declarePublic('cookString')
def cookString(text):
""" Make a Zope-friendly ID from 'text'.
@@ -109,6 +91,7 @@
cooked = re.sub(rgx, "",text).lower()
return cooked
+security.declarePublic('tuplize')
def tuplize( valueName, value ):
""" Make a tuple from 'value'.
@@ -126,9 +109,11 @@
#
# Security utilities, callable only from unrestricted code.
#
+security.declarePrivate('_getAuthenticatedUser')
def _getAuthenticatedUser( self ):
return getSecurityManager().getUser()
+security.declarePrivate('_checkPermission')
def _checkPermission(permission, obj, StringType = type('')):
roles = rolesForPermissionOn(permission, obj)
if type(roles) is StringType:
@@ -137,6 +122,7 @@
return 1
return 0
+security.declarePrivate('_verifyActionPermissions')
def _verifyActionPermissions(obj, action):
pp = action.get('permissions', ())
if not pp:
@@ -146,6 +132,7 @@
return 1
return 0
+security.declarePrivate('_getViewFor')
def _getViewFor(obj, view='view'):
ti = obj.getTypeInfo()
if ti is not None:
@@ -168,6 +155,7 @@
# If Zope ever provides a call to getRolesInContext() through
# the SecurityManager API, the method below needs to be updated.
+security.declarePrivate('_limitGrantedRoles')
def _limitGrantedRoles(roles, context, special_roles=()):
# Only allow a user to grant roles already possessed by that user,
# with the exception that all special_roles can also be granted.
@@ -185,6 +173,7 @@
limitGrantedRoles = _limitGrantedRoles # XXX: Deprecated spelling
+security.declarePrivate('_mergedLocalRoles')
def _mergedLocalRoles(object):
"""Returns a merging of object and its ancestors'
__ac_local_roles__."""
@@ -213,6 +202,7 @@
mergedLocalRoles = _mergedLocalRoles # XXX: Deprecated spelling
+security.declarePrivate('_ac_inherited_permissions')
def _ac_inherited_permissions(ob, all=0):
# Get all permissions not defined in ourself that are inherited
# This will be a sequence of tuples with a name as the first item and
@@ -231,6 +221,7 @@
r = list(perms) + r
return r
+security.declarePrivate('_modifyPermissionMappings')
def _modifyPermissionMappings(ob, map):
"""
Modifies multiple role to permission mappings.
@@ -303,11 +294,9 @@
security = ClassSecurityInfo()
- security.declarePrivate(
- 'manage_addProperty',
- 'manage_delProperties',
- 'manage_changePropertyTypes',
- )
+ security.declarePrivate('manage_addProperty')
+ security.declarePrivate('manage_delProperties')
+ security.declarePrivate('manage_changePropertyTypes')
def manage_propertiesForm(self, REQUEST, *args, **kw):
'An override that makes the schema fixed.'
@@ -578,7 +567,8 @@
getattr(self, self.element_types[c.getNodeName()])(c, level, output)
CMFHtmlWithImages = CMFHtmlWithImages()
-
+
+security.declarePublic('format_stx')
def format_stx( text, level=1 ):
"""
Render STX to HTML.
@@ -598,6 +588,7 @@
#
KEYSPLITRE = re.compile(r'[,;]')
+security.declarePublic('keywordsplitter')
def keywordsplitter( headers
, names=('Subject', 'Keywords',)
, splitter=KEYSPLITRE.split
@@ -614,6 +605,7 @@
#
# Directory-handling utilities
#
+security.declarePublic('normalize')
def normalize(p):
return os_path.abspath(os_path.normcase(os_path.normpath(p)))
@@ -622,6 +614,7 @@
separators = (os.sep, os.altsep)
+security.declarePublic('expandpath')
def expandpath(p):
# Converts a minimal path to an absolute path.
p = os_path.normpath(p)
@@ -632,6 +625,7 @@
return abs
return os_path.join(normSOFTWARE_HOME, p)
+security.declarePublic('minimalpath')
def minimalpath(p):
# Trims INSTANCE_HOME or SOFTWARE_HOME from a path.
p = os_path.abspath(p)