Logo Search packages:      
Sourcecode: mbot version File versions  Download package

def MailHandler::MailHandler::check_lists (   self,
  config 
) [inherited]

Check if the user is authorized to use the handler 

Definition at line 39 of file MailHandler.py.

                                 :
        """ Check if the user is authorized to use the handler """

      # Use email part of sender
        (name, sender) = rfc822.parseaddr(self.sender)
      self.log.debug("[check_lists]: sender = %s" % self.sender)
      self.log.debug("[check_lists]: sender(email) = %s" % sender)

        # First check black list
        if config.has_option(self.section, "BLACK_LIST"):
          self.log.debug("[check_lists]: BLACK_LIST exists")
            BL = config.get(self.section, "BLACK_LIST")
          self.log.debug("[check_lists]: BLACK_LIST=%s" % BL)
            if sender in BL:
                return False

        # Black list is not bloquing, check white list
        if config.has_option(self.section, "WHITE_LIST"):
          self.log.debug("[check_lists]: WHITE_LIST exists")
            WL = config.get(self.section, "WHITE_LIST")
          self.log.debug("[check_lists]: WHITE_LIST=%s" % WL)
            return sender in WL
        
        else:
            # If no white list is provided, mbot usage is accepted
            return True
            return True


Generated by  Doxygen 1.6.0   Back to index