def Allow(self, context, user): """ Checks if the transition can be executed in the current context. parameters :: context: the context object user: the current user returns True/False """ # condition if self.conditions: for c in self.conditions: if isinstance(c, basestring): c = ResolveName(c) if not c(transition=self, context=context, user=user, values=self.values): return False # roles if self.roles == WfAllRoles: return True if user: # call registered authentication policy groups = effective_principals() if groups == None: # no pyramid authentication policy activated # use custom user lookup groups = user.GetGroups(context) if context and ILocalGroups.providedBy(context): local = context.GetLocalGroups(unicode(user)) groups = list(groups) + list(local) else: groups = (u"system.Everyone", ) for r in groups: if r in self.process.adminGroups: return True if r in self.roles: return True return False
def Allow(self, context, user): """ Checks if the transition can be executed in the current context. parameters :: context: the context object user: the current user returns True/False """ # condition if self.conditions: for c in self.conditions: if isinstance(c, basestring): c = ResolveName(c) if not c(transition=self, context=context, user=user, values=self.values): return False # roles if self.roles == WfAllRoles: return True if user: # call registered authentication policy groups = effective_principals() if groups==None: # no pyramid authentication policy activated # use custom user lookup groups = user.GetGroups(context) if context and ILocalGroups.providedBy(context): local = context.GetLocalGroups(unicode(user)) groups = list(groups)+list(local) else: groups = (u"system.Everyone",) for r in groups: if r in self.process.adminGroups: return True if r in self.roles: return True return False
def test_principals(self): p = effective_principals() self.assert_(p==None)
def test_principals(self): p = effective_principals() self.assert_(p == None)