Commit 1f753db4 authored by Łukasz Nowak's avatar Łukasz Nowak

Cut down post copy&paste nonsense.

parent b605927e
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
# #
############################################################################## ##############################################################################
from zLOG import LOG, PROBLEM, WARNING from zLOG import LOG, PROBLEM
from Products.ERP5Type.Globals import InitializeClass from Products.ERP5Type.Globals import InitializeClass
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
import sys import sys
...@@ -43,8 +43,6 @@ from Products.ERP5Type.Cache import transactional_cached ...@@ -43,8 +43,6 @@ from Products.ERP5Type.Cache import transactional_cached
from Products.ERP5Security.ERP5UserManager import SUPER_USER from Products.ERP5Security.ERP5UserManager import SUPER_USER
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
from Products.ERP5Security.ERP5GroupManager import ConsistencyError, NO_CACHE_MODE from Products.ERP5Security.ERP5GroupManager import ConsistencyError, NO_CACHE_MODE
from Products.ERP5Type.ERP5Type \
import ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
#Form for new plugin in ZMI #Form for new plugin in ZMI
...@@ -161,40 +159,12 @@ class VifibShadowAuthenticationPlugin(BasePlugin): ...@@ -161,40 +159,12 @@ class VifibShadowAuthenticationPlugin(BasePlugin):
return () return ()
def _getGroupsForPrincipal(user_name, path): def _getGroupsForPrincipal(user_name, path):
security_category_dict = {} # key is the base_category_list,
# value is the list of fetched categories
security_group_list = []
security_definition_list = ()
# because we aren't logged in, we have to create our own # because we aren't logged in, we have to create our own
# SecurityManager to be able to access the Catalog # SecurityManager to be able to access the Catalog
sm = getSecurityManager() sm = getSecurityManager()
if sm.getUser().getId() != SUPER_USER: if sm.getUser().getId() != SUPER_USER:
newSecurityManager(self, self.getUser(SUPER_USER)) newSecurityManager(self, self.getUser(SUPER_USER))
try: try:
# To get the complete list of groups, we try to call the
# ERP5Type_getSecurityCategoryMapping which should return a list
# of lists of two elements (script, base_category_list) like :
# (
# ('script_1', ['base_category_1', 'base_category_2', ...]),
# ('script_2', ['base_category_1', 'base_category_3', ...])
# )
#
# else, if the script does not exist, falls back to a list containng
# only one list :
# (('ERP5Type_getSecurityCategoryFromAssignment',
# self.getPortalAssignmentBaseCategoryList() ),)
mapping_method = getattr(self,
'ERP5Type_getSecurityCategoryMapping', None)
if mapping_method is None:
security_definition_list = ((
'ERP5Type_getSecurityCategoryFromAssignment',
self.getPortalAssignmentBaseCategoryList()
),)
else:
security_definition_list = mapping_method()
# get the loggable document from its reference - no security check needed # get the loggable document from its reference - no security check needed
catalog_result = self.portal_catalog.unrestrictedSearchResults( catalog_result = self.portal_catalog.unrestrictedSearchResults(
portal_type=self.loggable_portal_type_list, portal_type=self.loggable_portal_type_list,
...@@ -208,7 +178,6 @@ class VifibShadowAuthenticationPlugin(BasePlugin): ...@@ -208,7 +178,6 @@ class VifibShadowAuthenticationPlugin(BasePlugin):
repr([r.getObject() for r in catalog_result])) repr([r.getObject() for r in catalog_result]))
else: else:
return () return ()
loggable_object = catalog_result[0].getObject()
finally: finally:
setSecurityManager(sm) setSecurityManager(sm)
......
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