Commit cc3a8079 authored by Georgios Dagkakis's avatar Georgios Dagkakis

erp5_core: extension.erp5.StandardSecurity cleanup

- Remove unused imports and variable
- Do not have empty list as argument default
- Allow object as redefined-builtin in pylint, for the lines it is used
Note: this variable is not anywhere and it should be 'self', but
I do not want to break callers
parent 17efe78a
...@@ -24,13 +24,16 @@ ...@@ -24,13 +24,16 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
############################################################################## ##############################################################################
from Products.ERP5Security.ERP5GroupManager import ConsistencyError
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery
from DateTime import DateTime from DateTime import DateTime
def getSecurityCategoryFromAssignment(self, base_category_list, user_name, object, portal_type, def getSecurityCategoryFromAssignment(
child_category_list=[]): self,
base_category_list,
user_name,
object, # pylint: disable=redefined-builtin
portal_type,
child_category_list=None
):
""" """
This script returns a list of dictionaries which represent This script returns a list of dictionaries which represent
the security groups which a person is member of. It extracts the security groups which a person is member of. It extracts
...@@ -50,9 +53,9 @@ def getSecurityCategoryFromAssignment(self, base_category_list, user_name, objec ...@@ -50,9 +53,9 @@ def getSecurityCategoryFromAssignment(self, base_category_list, user_name, objec
object -- object which we want to assign roles to object -- object which we want to assign roles to
portal_type -- portal type of object portal_type -- portal type of object
""" """
context = self
category_list = [] category_list = []
if child_category_list is None:
child_category_list = []
user_path_set = { user_path_set = {
x['path'] for x in self.acl_users.searchUsers( x['path'] for x in self.acl_users.searchUsers(
...@@ -95,22 +98,31 @@ def getSecurityCategoryFromAssignment(self, base_category_list, user_name, objec ...@@ -95,22 +98,31 @@ def getSecurityCategoryFromAssignment(self, base_category_list, user_name, objec
return category_list return category_list
def getSecurityCategoryFromAssignmentParent(self, base_category_list, def getSecurityCategoryFromAssignmentParent(self, base_category_list, user_name,
user_name, object, portal_type): object, # pylint: disable=redefined-builtin
return getSecurityCategoryFromAssignment(self, base_category_list, portal_type):
user_name, object, portal_type, child_category_list=base_category_list) return getSecurityCategoryFromAssignment(self, base_category_list, user_name,
object, # pylint: disable=redefined-builtin
portal_type, child_category_list=base_category_list)
def getSecurityCategoryFromAssignmentParentGroup(self, base_category_list, user_name,
object, # pylint: disable=redefined-builtin
portal_type):
return getSecurityCategoryFromAssignment(self, base_category_list, user_name,
object, # pylint: disable=redefined-builtin
portal_type, child_category_list=('group',))
def getSecurityCategoryFromAssignmentParentGroup(self, base_category_list, def getSecurityCategoryFromAssignmentParentFunction(self, base_category_list, user_name,
user_name, object, portal_type): object, # pylint: disable=redefined-builtin
return getSecurityCategoryFromAssignment(self, base_category_list, portal_type):
user_name, object, portal_type, child_category_list=('group',)) return getSecurityCategoryFromAssignment(self, base_category_list, user_name,
object, # pylint: disable=redefined-builtin
portal_type, child_category_list=('function',))
def getSecurityCategoryFromAssignmentParentFunction(self, base_category_list, def getSecurityCategoryFromAssignmentParentFunctionParentGroup(self, base_category_list, user_name,
user_name, object, portal_type): object, # pylint: disable=redefined-builtin
return getSecurityCategoryFromAssignment(self, base_category_list, portal_type):
user_name, object, portal_type, child_category_list=('function',)) return getSecurityCategoryFromAssignment(self, base_category_list, user_name,
object, # pylint: disable=redefined-builtin
portal_type, child_category_list=('function', 'group'))
def getSecurityCategoryFromAssignmentParentFunctionParentGroup(self, base_category_list,
user_name, object, portal_type):
return getSecurityCategoryFromAssignment(self, base_category_list,
user_name, object, portal_type, child_category_list=('function', 'group'))
...@@ -45,17 +45,7 @@ ...@@ -45,17 +45,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 32, 75: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W: 32, 0: Dangerous default value [] as argument (dangerous-default-value)</string>
<string>W: 53, 2: Unused variable \'context\' (unused-variable)</string>
<string>W: 99, 50: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:104, 50: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:109, 50: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:114, 50: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W: 28, 0: Unused ConsistencyError imported from Products.ERP5Security.ERP5GroupManager (unused-import)</string>
<string>W: 29, 0: Unused SimpleQuery imported from Products.ZSQLCatalog.SQLCatalog (unused-import)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
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