diff --git a/bt5/erp5_egov/ExtensionTemplateItem/StandardSecurity.py b/bt5/erp5_egov/ExtensionTemplateItem/StandardSecurity.py deleted file mode 100644 index 88c815f4b8af3198bbaff5fd79e5789ae3755b83..0000000000000000000000000000000000000000 --- a/bt5/erp5_egov/ExtensionTemplateItem/StandardSecurity.py +++ /dev/null @@ -1,185 +0,0 @@ -############################################################################## -# -# Copyright (c) 2002-2007 Nexedi SARL and Contributors. All Rights Reserved. -# -# WARNING: This program as such is intended to be used by professional -# programmers who take the whole responsability of assessing all potential -# consequences resulting from its eventual inadequacies and bugs -# End users who are looking for a ready-to-use solution with commercial -# garantees and support are strongly adviced to contract a Free Software -# Service Company -# -# This program is Free Software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -############################################################################## - -from Products.ERP5Security.ERP5GroupManager import ConsistencyError - -def getSecurityCategoryFromAssignment(self, base_category_list, user_name, - object, portal_type, child_category_list=[]): - """ - This script returns a list of dictionaries which represent - the security groups which a person is member of. It extracts - the categories from the current user assignment. - It is useful in the following cases: - - - associate a document (ex. an accounting transaction) - to the division which the user was assigned to - at the time it was created - - - calculate security membership of a user - - The parameters are - - base_category_list -- list of category values we need to retrieve - user_name -- string obtained from - getSecurityManager().getUser().getId() - object -- object which we want to assign roles to - portal_type -- portal type of object - """ - category_list = [] - person_object_list = self.portal_catalog.unrestrictedSearchResults(\ - portal_type='Person', reference=user_name) - - if len(person_object_list) != 1: - if len(person_object_list) > 1: - raise ConsistencyError, "Error: There is more than one Person with reference '%s'" % user_name - else: - # if a person_object was not found in the module, we do nothing more - # this happens for example when a manager with no associated person - # object creates a person_object for a new user - return [] - person_object = person_object_list[0].getObject() - - # We look for every valid assignments of this user - assignment_list = person_object.contentValues(filter={'portal_type':'Assignment'}) - for assignment in assignment_list: - if assignment.getValidationState() == 'open': - category_dict = {} - for base_category in base_category_list: - category_value_list = assignment.getAcquiredValueList(base_category) - if category_value_list: - for category_value in category_value_list: - if base_category in child_category_list: - if category_value.getPortalType() not in \ - ('Base Category', 'ERP5 Site'): - while category_value.getPortalType() not in \ - ('Base Category', 'ERP5 Site'): - category_dict.setdefault(base_category, []).append('%s*' % \ - category_value.getRelativeUrl()) - category_value = category_value.getParentValue() - else: - category_dict.setdefault(base_category, []).append(category_value.getRelativeUrl()) - else: - category_dict.setdefault(base_category, []).append(category_value.getRelativeUrl()) - category_list.append(category_dict) - - return category_list - - -def getSecurityCategoryFromEntity(self, base_category_list, entity_name, - object, portal_type, child_category_list=None, portal_type_list=None): - """ - This script returns a list of dictionaries which represent - the security groups which a person is member of. It extracts - the categories from the current user assignment. - It is useful in the following cases: - - - associate a document (ex. an accounting transaction) - to the division which the user was assigned to - at the time it was created - - - calculate security membership of a user - - The parameters are - - base_category_list -- list of category values we need to retrieve - entity_name -- string obtained from - getSecurityManager().getUser().getId() - object -- object which we want to assign roles to - portal_type_list -- list of portal type to search the entity - """ - if portal_type_list is None: - portal_type_list = self.portal_type_list - if child_category_list is None: - child_category_list = [] - - category_list = [] - object_list = self.portal_catalog.unrestrictedSearchResults(portal_type=portal_type_list, reference=entity_name) - - if len(object_list) != 1: - if len(object_list) > 1: - raise ConsistencyError, "Error: There is more than one Entity with reference '%s'" % entity_name - else: - # if a person_object was not found in the module, we do nothing more - # this happens for example when a manager with no associated person - # object creates a person_object for a new user - - portal = self.getPortalObject() - - # this permit to get the module of the application. The goal is to - # work with anonymous applications, even if they are not reindexed - module_id = self.REQUEST.get('anonymous_module', None) - if module_id: - module = getattr(portal, module_id, None) - if module is not None: - result = module._getOb(entity_name, None) - if result is not None: - object = result - else: - return [] - else: - return [] - else: - object = object_list[0].getObject() - - category_dict = {} - for base_category in base_category_list: - category_value_list = object.getAcquiredValueList(base_category) - if category_value_list: - for category_value in category_value_list: - if base_category in child_category_list: - if category_value.getPortalType() not in \ - ('Base Category', 'ERP5 Site'): - while category_value.getPortalType() not in \ - ('Base Category', 'ERP5 Site'): - category_dict.setdefault(base_category, []).append('%s*' % \ - category_value.getRelativeUrl()) - category_value = category_value.getParentValue() - else: - category_dict.setdefault(base_category, []).append(category_value.getRelativeUrl()) - else: - category_dict.setdefault(base_category, []).append(category_value.getRelativeUrl()) - category_list.append(category_dict) - - return category_list - - - -def getSecurityCategoryFromAssignmentParent(self, base_category_list, - user_name, object, portal_type): - return getSecurityCategoryFromAssignment(self, base_category_list, - user_name, object, portal_type, child_category_list=base_category_list) - -def getSecurityCategoryFromAssignmentParentGroup(self, base_category_list, - user_name, object, portal_type): - return getSecurityCategoryFromAssignment(self, base_category_list, - user_name, object, portal_type, child_category_list=('group',)) - -def getSecurityCategoryFromAssignmentParentFunction(self, base_category_list, - user_name, object, portal_type): - return getSecurityCategoryFromAssignment(self, base_category_list, - user_name, object, portal_type, child_category_list=('function',)) - diff --git a/bt5/erp5_egov/bt/change_log b/bt5/erp5_egov/bt/change_log index 55317cf59ef1136a49e70204c42aa8f02b7c76d8..0444c2a5f0c0284e47660ede9516ea0888110a78 100644 --- a/bt5/erp5_egov/bt/change_log +++ b/bt5/erp5_egov/bt/change_log @@ -1,3 +1,6 @@ +2008-09-23 fabien +* remove standardSecurity extension. The name was in conflict with an Extension in erp5_core. Move it in safi_egov bt and rename it in ERP5EGov_Security. + 2008-09-12 fabien * Change all indentation, thanks to julien patch * move annonymous_workflow from egov public bt to safi_egov private bt wich is a more appropriate place. diff --git a/bt5/erp5_egov/bt/revision b/bt5/erp5_egov/bt/revision index 5ca234cb538117d188296311c2d9abaf364c847c..d35d5f782448e98ccbcb1fa8e162c079cc627e52 100644 --- a/bt5/erp5_egov/bt/revision +++ b/bt5/erp5_egov/bt/revision @@ -1 +1 @@ -345 \ No newline at end of file +347 \ No newline at end of file diff --git a/bt5/erp5_egov/bt/template_extension_id_list b/bt5/erp5_egov/bt/template_extension_id_list index 5bc01e986efae64e494cfa808473bcd61c9852fd..d8bb2b894e338aeaa8a7841c3d3047681c50a3f3 100644 --- a/bt5/erp5_egov/bt/template_extension_id_list +++ b/bt5/erp5_egov/bt/template_extension_id_list @@ -1,3 +1,2 @@ -StandardSecurity Captcha ERP5EGov_Extensions \ No newline at end of file