コード例 #1
0
ファイル: workspace.py プロジェクト: gelie/bungeni_src
 def getMessage(self):
     """Check signatories validator and generate status message
     of the form {"level": <level> , "message_text": "<i18n_message>"}
     """
     message = {"level": "info", "message_text": u""}
     validator = ISignatoryManager(self.context, None)
     if validator is None:
         return message
     if validator.require_signatures():
         if validator.validate_consented_signatories():
             message["message_text"] = _(
                 "signature_requirement_met",
                 default=(
                     u"This document has the required number of "
                     u"signatories. ${signed_members} member(s) have signed"
                     u". ${required_members} signature(s) required."),
                 mapping={
                     "signed_members": validator.consented_signatories,
                     "required_members": validator.min_signatories
                 })
         else:
             message["level"] = "warning"
             message["message_text"] = _(
                 "signature_requirements_not_met",
                 default=(u"This document does not have the required "
                          u"number of signatories. Requires "
                          u"${required_members} signature(s). "
                          u"${signed_members} member(s) have signed."),
                 mapping={
                     "required_members": validator.min_signatories,
                     "signed_members": validator.consented_signatories
                 })
     return message
コード例 #2
0
ファイル: workspace.py プロジェクト: gelie/bungeni_src
 def getMessage(self):
     """Check signatories validator and generate status message
     of the form {"level": <level> , "message_text": "<i18n_message>"}
     """
     message = {"level": "info", "message_text": u""}
     validator = ISignatoryManager(self.context, None)
     if validator is None:
         return message
     if validator.require_signatures():
         if validator.validate_consented_signatories():
             message["message_text"] = _("signature_requirement_met",
                 default=(u"This document has the required number of "
                     u"signatories. ${signed_members} member(s) have signed"
                     u". ${required_members} signature(s) required."
                 ),
                 mapping = {
                     "signed_members": validator.consented_signatories,
                     "required_members": validator.min_signatories
                 }
             )
         else:
             message["level"] = "warning"
             message["message_text"] = _("signature_requirements_not_met",
                     default=(u"This document does not have the required "
                         u"number of signatories. Requires "
                         u"${required_members} signature(s). " 
                         u"${signed_members} member(s) have signed."
                     ),
                     mapping={
                         "required_members": validator.min_signatories,
                         "signed_members": validator.consented_signatories
                     }
             )
     return message
コード例 #3
0
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 (user_is_context_owner(context, context.owner.user_id)
                and (manager.document_submitted() or manager.auto_sign())
                and user_is_not_parent_document_owner(context))
    return False
コード例 #4
0
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
コード例 #5
0
def pi_unsign_signature(context):
    manager = ISignatoryManager(context.head, None)
    if manager:
        return ((pi_document_redrafted(context) and 
            user_is_not_parent_document_owner(context))
        )
    return False
コード例 #6
0
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 user_is_not_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
コード例 #7
0
def pi_signatories_check(context):
    manager = ISignatoryManager(context, None)
    if manager is not None:
        return manager.validate_consented_signatories()
    return True
コード例 #8
0
def pi_has_signatories(context):
    manager = ISignatoryManager(context, None)
    if manager is not None:
        return manager.validate_signatories()
    return True
コード例 #9
0
ファイル: common.py プロジェクト: mohalfaki/bungeni-portal
 def handle_sign_document(self, action, data):
     user_id = get_db_user_id()
     manager = ISignatoryManager(self.context)
     manager.sign_document(user_id)
     self.request.response.redirect(self.nextURL())
コード例 #10
0
ファイル: common.py プロジェクト: mohalfaki/bungeni-portal
 def _can_review_signature(self, action):
     manager = ISignatoryManager(self.context)
     return manager.is_signatory(get_db_user_id())
コード例 #11
0
ファイル: common.py プロジェクト: BenoitTalbot/bungeni-portal
 def _can_review_signature(self, action):
     manager = ISignatoryManager(self.context)
     return manager.is_signatory(get_db_user_id())
コード例 #12
0
def pi_allow_signature(context):
    manager = ISignatoryManager(context.head, None)
    if manager is not None:
        return (user_is_context_owner(context, context.owner.user_id)
                and manager.allow_signature())
    return False
コード例 #13
0
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
コード例 #14
0
def pi_document_redrafted(context):
    """Parent document has been redrafted"""
    manager = ISignatoryManager(context.head, None)
    return manager and manager.document_is_draft()
コード例 #15
0
def pi_signature_period_expired(context):
    """The document has been submitted"""
    manager = ISignatoryManager(context.head, None)
    if manager is not None:
        return manager.expire_signatures()
    return False
コード例 #16
0
def pi_signatories_check(context):
    manager = ISignatoryManager(context, None)
    if manager is not None:
        return manager.validate_consented_signatories()
    return True
コード例 #17
0
def pi_has_signatories(context):
    manager = ISignatoryManager(context, None)
    if manager is not None:
        return manager.validate_signatories()
    return True
コード例 #18
0
def pi_signature_period_expired(context):
    """The document has been submitted"""
    manager = ISignatoryManager(context.head, None)
    if manager is not None:
        return manager.expire_signatures()
    return False
コード例 #19
0
def pi_document_redrafted(context):
    """Parent document has been redrafted"""
    manager = ISignatoryManager(context.head, None)
    return manager and manager.document_is_draft()
コード例 #20
0
ファイル: common.py プロジェクト: BenoitTalbot/bungeni-portal
 def _can_sign_document(self, action):
     manager = ISignatoryManager(self.context)
     return manager.can_sign()
コード例 #21
0
ファイル: common.py プロジェクト: mohalfaki/bungeni-portal
 def _can_sign_document(self, action):
     manager = ISignatoryManager(self.context)
     return manager.can_sign()
コード例 #22
0
ファイル: common.py プロジェクト: BenoitTalbot/bungeni-portal
 def handle_sign_document(self, action, data):
     user_id = get_db_user_id()
     manager = ISignatoryManager(self.context)
     manager.sign_document(user_id)
     self.request.response.redirect(self.nextURL())