[Checkins] SVN: Products.CMFCore/trunk/Products/CMFCore/ - call getSecurityManager().getUser() directly

Yvo Schubbe y.2011 at wcm-solutions.de
Thu Feb 17 07:57:24 EST 2011


Log message for revision 120412:
  - call getSecurityManager().getUser() directly

Changed:
  UU  Products.CMFCore/trunk/Products/CMFCore/CMFCatalogAware.py
  UU  Products.CMFCore/trunk/Products/CMFCore/CatalogTool.py
  UU  Products.CMFCore/trunk/Products/CMFCore/MembershipTool.py
  UU  Products.CMFCore/trunk/Products/CMFCore/UndoTool.py
  U   Products.CMFCore/trunk/Products/CMFCore/utils.py

-=-
Modified: Products.CMFCore/trunk/Products/CMFCore/CMFCatalogAware.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/CMFCatalogAware.py	2011-02-17 07:25:48 UTC (rev 120411)
+++ Products.CMFCore/trunk/Products/CMFCore/CMFCatalogAware.py	2011-02-17 12:57:23 UTC (rev 120412)
@@ -11,13 +11,12 @@
 #
 ##############################################################################
 """ Base class for catalog aware content items.
-
-$Id$
 """
 
 import logging
 
 from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
 from Acquisition import aq_base
 from App.class_init import InitializeClass
 from App.special_dtml import DTMLFile
@@ -39,7 +38,6 @@
 from Products.CMFCore.permissions import ManagePortal
 from Products.CMFCore.permissions import ModifyPortalContent
 from Products.CMFCore.utils import _dtmldir
-from Products.CMFCore.utils import _getAuthenticatedUser
 from Products.CMFCore.utils import getToolByName
 
 logger = logging.getLogger('CMFCore.CMFCatalogAware')
@@ -288,7 +286,7 @@
     """
     # Make sure owner local role is set after pasting
     # The standard Zope mechanisms take care of executable ownership
-    current_user = _getAuthenticatedUser(ob)
+    current_user = getSecurityManager().getUser()
     if current_user is None:
         return
 


Property changes on: Products.CMFCore/trunk/Products/CMFCore/CMFCatalogAware.py
___________________________________________________________________
Deleted: svn:keywords
   - Author Date Id Revision

Modified: Products.CMFCore/trunk/Products/CMFCore/CatalogTool.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/CatalogTool.py	2011-02-17 07:25:48 UTC (rev 120411)
+++ Products.CMFCore/trunk/Products/CMFCore/CatalogTool.py	2011-02-17 12:57:23 UTC (rev 120412)
@@ -11,8 +11,6 @@
 #
 ##############################################################################
 """ Basic portal catalog.
-
-$Id$
 """
 
 from AccessControl.PermissionRole import rolesForPermissionOn
@@ -42,7 +40,6 @@
 from Products.CMFCore.permissions import View
 from Products.CMFCore.utils import _checkPermission
 from Products.CMFCore.utils import _dtmldir
-from Products.CMFCore.utils import _getAuthenticatedUser
 from Products.CMFCore.utils import _mergedLocalRoles
 from Products.CMFCore.utils import getToolByName
 from Products.CMFCore.utils import UniqueObject
@@ -180,7 +177,7 @@
             Calls ZCatalog.searchResults with extra arguments that
             limit the results to what the user is allowed to see.
         """
-        user = _getAuthenticatedUser(self)
+        user = getSecurityManager().getUser()
         kw[ 'allowedRolesAndUsers' ] = self._listAllowedRolesAndUsers( user )
 
         if not _checkPermission( AccessInactivePortalContent, self ):


Property changes on: Products.CMFCore/trunk/Products/CMFCore/CatalogTool.py
___________________________________________________________________
Deleted: svn:keywords
   - Author Date Id Revision

Modified: Products.CMFCore/trunk/Products/CMFCore/MembershipTool.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/MembershipTool.py	2011-02-17 07:25:48 UTC (rev 120411)
+++ Products.CMFCore/trunk/Products/CMFCore/MembershipTool.py	2011-02-17 12:57:23 UTC (rev 120412)
@@ -11,15 +11,14 @@
 #
 ##############################################################################
 """ Basic membership tool.
-
-$Id$
 """
 
 import logging
 from warnings import warn
 
-from AccessControl.SecurityInfo import ClassSecurityInfo
 from AccessControl.requestmethod import postonly
+from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
 from AccessControl.User import nobody
 from Acquisition import aq_base
 from Acquisition import aq_inner
@@ -46,7 +45,6 @@
 from Products.CMFCore.permissions import View
 from Products.CMFCore.utils import _checkPermission
 from Products.CMFCore.utils import _dtmldir
-from Products.CMFCore.utils import _getAuthenticatedUser
 from Products.CMFCore.utils import getToolByName
 from Products.CMFCore.utils import UniqueObject
 
@@ -113,7 +111,7 @@
         Returns the currently authenticated member object
         or the Anonymous User.  Never returns None.
         '''
-        u = _getAuthenticatedUser(self)
+        u = getSecurityManager().getUser()
         if u is None:
             u = nobody
         return self.wrapUser(u)
@@ -253,7 +251,7 @@
             return None
         # Note: We can't use getAuthenticatedMember() and getMemberById()
         # because they might be wrapped by MemberDataTool.
-        user = _getAuthenticatedUser(self)
+        user = getSecurityManager().getUser()
         user_id = user.getId()
         if member_id in ('', user_id):
             member = user
@@ -307,7 +305,7 @@
         '''
         Returns 1 if the user is not logged in.
         '''
-        u = _getAuthenticatedUser(self)
+        u = getSecurityManager().getUser()
         if u is None or u.getUserName() == 'Anonymous User':
             return 1
         return 0
@@ -331,7 +329,7 @@
         databases.
         '''
         if not self.isAnonymousUser():
-            user = _getAuthenticatedUser(self)
+            user = getSecurityManager().getUser()
             name = user.getUserName()
             # this really does need to be the user name, and not the user id,
             # because we're dealing with authentication credentials


Property changes on: Products.CMFCore/trunk/Products/CMFCore/MembershipTool.py
___________________________________________________________________
Deleted: svn:keywords
   - Author Date Id Revision

Modified: Products.CMFCore/trunk/Products/CMFCore/UndoTool.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/UndoTool.py	2011-02-17 07:25:48 UTC (rev 120411)
+++ Products.CMFCore/trunk/Products/CMFCore/UndoTool.py	2011-02-17 12:57:23 UTC (rev 120412)
@@ -11,11 +11,10 @@
 #
 ##############################################################################
 """ Basic undo tool.
-
-$Id$
 """
 
 from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.SecurityManagement import getSecurityManager
 from App.class_init import InitializeClass
 from App.special_dtml import DTMLFile
 from OFS.SimpleItem import SimpleItem
@@ -27,7 +26,6 @@
 from Products.CMFCore.permissions import ManagePortal
 from Products.CMFCore.utils import _checkPermission
 from Products.CMFCore.utils import _dtmldir
-from Products.CMFCore.utils import _getAuthenticatedUser
 from Products.CMFCore.utils import registerToolInterface
 from Products.CMFCore.utils import UniqueObject
 
@@ -74,7 +72,7 @@
             t['id'] = t['id'].replace('\n', '')
         if not _checkPermission(ManagePortal, object):
             # Filter out transactions done by other members of the portal.
-            user_id = _getAuthenticatedUser(self).getId()
+            user_id = getSecurityManager().getUser().getId()
             transactions = filter(
                 lambda record, user_id=user_id:
                 record['user_name'].split()[-1] == user_id,


Property changes on: Products.CMFCore/trunk/Products/CMFCore/UndoTool.py
___________________________________________________________________
Deleted: svn:keywords
   - Author Date Id Revision

Modified: Products.CMFCore/trunk/Products/CMFCore/utils.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/utils.py	2011-02-17 07:25:48 UTC (rev 120411)
+++ Products.CMFCore/trunk/Products/CMFCore/utils.py	2011-02-17 12:57:23 UTC (rev 120412)
@@ -173,6 +173,7 @@
 #
 #   Security utilities, callable only from unrestricted code.
 #
+# deprecated alias
 security.declarePrivate('_getAuthenticatedUser')
 def _getAuthenticatedUser(self):
     return getSecurityManager().getUser()
@@ -187,7 +188,7 @@
 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.
-    user = _getAuthenticatedUser(context)
+    user = getSecurityManager().getUser()
     if user is None:
         user_roles = ()
     else:



More information about the checkins mailing list