Commit 86b00be0 authored by iv's avatar iv

ERP5Workflow: remove useless guard methods

parent ab447bd0
...@@ -65,12 +65,6 @@ class WorkflowVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject): ...@@ -65,12 +65,6 @@ class WorkflowVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
PropertySheet.WorkflowVariable, PropertySheet.WorkflowVariable,
) )
def getInfoGuardSummary(self):
res = None
if self.getGuard() is not None:
res = self.info_guard.getSummary()
return res
def getInfoGuard(self): def getInfoGuard(self):
if self.getGuardRoleList() is None and\ if self.getGuardRoleList() is None and\
self.getGuardPermissionList() is None and\ self.getGuardPermissionList() is None and\
......
...@@ -97,64 +97,6 @@ class GuardableMixin(object): ...@@ -97,64 +97,6 @@ class GuardableMixin(object):
return False return False
return True return True
security.declareProtected(ManagePortal, 'getSummary')
def getSummary(self):
# Perhaps ought to be in DTML.
summary = []
if self.guard_permission:
summary.append('Requires permission:')
summary.append(formatNameUnion(self.guard_permission))
if self.guard_role:
if summary:
summary.append('<br/>')
summary.append('Requires role:')
summary.append(formatNameUnion(self.guard_role))
if self.guard_group:
if summary:
summary.append('<br/>')
summary.append('Requires group:')
summary.append(formatNameUnion(self.guard_group))
if self.guard_expression is not None:
if summary:
summary.append('<br/>')
summary.append('Requires expr:')
summary.append('<code>' + escape(self.guard_expression.text) + '</code>')
return ' '.join(summary)
def changeFromProperties(self, props):
'''
Returns True if changes were specified.
'''
if props is None:
return False
changed = False
given_property = props.get('guard_permission', None)
if given_property:
changed = True
permission_list = [permission.strip() for permission in
given_property.split(';')]
self.guard_permission = tuple(permission_list)
given_property = props.get('guard_role', None)
if given_property:
changed = True
role_list = [role.strip() for role in given_property.split(';')]
self.guard_role = tuple(role_list)
given_property = props.get('guard_group', None)
if given_property:
changed = True
group_list = [ group.strip() for group in given_property.split(';') ]
self.guard_group = tuple(group_list)
given_property = props.get('guard_expression', None)
if given_property:
changed = True
self.guard_expression = Expression(given_property)
return changed
def _setGuardExpression(self, text): def _setGuardExpression(self, text):
if text: if text:
self.guard_expression = Expression(text) self.guard_expression = Expression(text)
...@@ -165,11 +107,3 @@ class GuardableMixin(object): ...@@ -165,11 +107,3 @@ class GuardableMixin(object):
if self.guard_expression is None: if self.guard_expression is None:
return Expression('') return Expression('')
return self.guard_expression return self.guard_expression
def formatNameUnion(names):
escaped = ['<code>' + escape(name) + '</code>' for name in names]
if len(escaped) == 2:
return ' or '.join(escaped)
elif len(escaped) > 2:
escaped[-1] = ' or ' + escaped[-1]
return '; '.join(escaped)
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