diff --git a/gen/__init__.py b/gen/__init__.py index 6d22d64..0a75efc 100644 --- a/gen/__init__.py +++ b/gen/__init__.py @@ -2631,7 +2631,7 @@ class Transition: break return res - def isTriggerable(self, obj, wf): + def isTriggerable(self, obj, wf, noSecurity=False): '''Can this transition be triggered on p_obj?''' wf = wf.__instance__ # We need the prototypical instance here. # Checks that the current state of the object is a start state for this @@ -2651,6 +2651,7 @@ class Transition: if isinstance(self.condition, Role): # Condition is a role. Transition may be triggered if the user has # this role. + if noSecurity: return True return user.has_role(self.condition.name, obj) elif type(self.condition) == types.FunctionType: return self.condition(wf, obj.appy()) @@ -2663,7 +2664,7 @@ class Transition: if isinstance(roleOrFunction, basestring): if hasRole == None: hasRole = False - if user.has_role(roleOrFunction, obj): + if user.has_role(roleOrFunction, obj) or noSecurity: hasRole = True elif type(roleOrFunction) == types.FunctionType: if not roleOrFunction(wf, obj.appy()): diff --git a/gen/mixins/__init__.py b/gen/mixins/__init__.py index c6c4b37..12e93ed 100644 --- a/gen/mixins/__init__.py +++ b/gen/mixins/__init__.py @@ -1071,7 +1071,7 @@ class BaseMixin: return self.goto(msg) def trigger(self, transitionName, comment='', doAction=True, doNotify=True, - doHistory=True, doSay=True): + doHistory=True, doSay=True, noSecurity=False): '''Triggers transition named p_transitionName.''' # Check that this transition exists. wf = self.getWorkflow() @@ -1080,7 +1080,7 @@ class BaseMixin: raise 'Transition "%s" was not found.' % transitionName # Is this transition triggerable? transition = getattr(wf, transitionName) - if not transition.isTriggerable(self, wf): + if not transition.isTriggerable(self, wf, noSecurity=noSecurity): raise 'Transition "%s" can\'t be triggered.' % transitionName # Trigger the transition transition.trigger(transitionName, self, wf, comment, doAction=doAction, diff --git a/gen/ui/page.pt b/gen/ui/page.pt index 53d5d00..475b328 100644 --- a/gen/ui/page.pt +++ b/gen/ui/page.pt @@ -86,9 +86,9 @@