def signatory_allowed_actions(signatory): """allow/disallow other signature actions => such as withdraw and reject """ signatory_feature = signatory.head.signatory_feature return (signatory_feature and utils.user_is_context_owner(signatory) and (signatory_feature.document_submitted(signatory.head) or signatory_feature.auto_sign(signatory.head)) and signatory_is_not_parent_document_owner(signatory))
def pi_allow_signature_actions(context): """allow/disallow other signature actions => such as withdraw and reject """ manager = ISignatoryManager(context.head, None) if manager is not None: return (utils.user_is_context_owner(context) and (manager.document_submitted() or manager.auto_sign()) and user_is_not_parent_document_owner(context)) return False
def signatory_auto_sign(context): """Determines whether signature is automatically signed when a signatory is added. Whenever the signature is that of the document owner, we auto sign. Also, signature is signed if parent document is created on behalf of a member. The assumption is that the user has provided a list of consented signatories to the document. """ if user_is_parent_document_owner(context): return True # if user adding signatory is not parent document owner, then auto sign #!+SIGNATORIES(mb, aug-2011) this could be tricky versus checking if parent # document is in a 'working_draft' state if not utils.user_is_context_owner(context.head): return True #!+(mb, Jul-2012) move all signatory logic to signatory manager if ISignatoryManager(context.head).auto_sign(): return True return False
def signatory_auto_sign(signatory): """Determines whether signature is automatically signed when a signatory is added. Whenever the signature is that of the document owner, we auto sign. Also, signature is signed if parent document is created on behalf of a member. The assumption is that the user has provided a list of consented signatories to the document. """ #if user_is_parent_document_owner(signatory): # !+ called before signatory is created! Owner role not yet set... if signatory.user_id == signatory.head.owner_id: return True # if user adding signatory is not parent document owner, then auto sign #!+SIGNATORIES(mb, aug-2011) this could be tricky versus checking if parent # document is in a 'working_draft' state head = signatory.head if not utils.user_is_context_owner(head): return True return head.signatory_feature.auto_sign(head)
def pi_allow_signature(context): manager = ISignatoryManager(context.head, None) if manager is not None: return utils.user_is_context_owner(context) and manager.allow_signature() return False
def signatory_allowed_sign(signatory): signatory_feature = signatory.head.signatory_feature return (signatory_feature and utils.user_is_context_owner(signatory) and signatory_feature.allow_signature(signatory.head))