Exemple #1
0
def listDrop():
    _list = request.url_rule.rule.split("/")[2].lower()
    if _list == "whitelist":
        dropWhitelist()
    else:
        dropBlacklist()
    return jsonify({"status": _list[0] + "l_dropped"})
Exemple #2
0
 def listDrop(self):
   _list = request.url_rule.split('/')[2].lower()
   if _list == 'whitelist':
     wl.dropWhitelist()
   else:
     bl.dropBlacklist()
   return jsonify({"status": _list[0]+"l_dropped"})
Exemple #3
0
 def listDrop(self):
     _list = request.url_rule.split('/')[2].lower()
     if _list == 'whitelist':
         wl.dropWhitelist()
     else:
         bl.dropBlacklist()
     return jsonify({"status": _list[0] + "l_dropped"})
Exemple #4
0
    def listDrop(self):
        _list = str(request.url_rule).split('/')[2].lower()
        logging.info('User {0} is droping {1}'.format(current_user.get_id(),
                                                      _list))
        if _list == 'whitelist':

            wl.dropWhitelist(current_user.get_id())
        else:
            bl.dropBlacklist(current_user.get_id())
        return jsonify({"status": _list[0] + "l_dropped"})
Exemple #5
0
    def delete(self):
        """
        Drop

        Endpoint that drops the content of the blacklist.
        """
        return {"message": dropBlacklist()}
Exemple #6
0
 def listImport(self, force=None, path=None):
   _list = request.url_rule.split('/')[2]
   file = request.files['file']
   force = request.form.get('force')
   count = wl.countWhitelist() if _list.lower == 'whitelist' else bl.countBlacklist()
   if (count == 0) | (not count) | (force == "f"):
     if _list.lower == 'whitelist':
       wl.dropWhitelist()
       wl.importWhitelist(TextIOWrapper(file.stream))
     else:
       bl.dropBlacklist()
       bl.importBlacklist(TextIOWrapper(file.stream))
     status = _list[0]+"l_imported"
   else:
     status = _list[0]+"l_already_filled"
   return render_template('admin.html', status=status, **self.adminInfo())
Exemple #7
0
 def listImport(self, force=None, path=None):
   _list = request.url_rule.split('/')[2]
   file = request.files['file']
   force = request.form.get('force')
   count = wl.countWhitelist() if _list.lower == 'whitelist' else bl.countBlacklist()
   if (count == 0) | (not count) | (force == "f"):
     if _list.lower == 'whitelist':
       wl.dropWhitelist()
       wl.importWhitelist(TextIOWrapper(file.stream))
     else:
       bl.dropBlacklist()
       bl.importBlacklist(TextIOWrapper(file.stream))
     status = _list[0]+"l_imported"
   else:
     status = _list[0]+"l_already_filled"
   return render_template('admin.html', status=status, **self.adminInfo())
Exemple #8
0
def listImport():
    _list = request.url_rule.rule.split("/")[2]
    file = request.files["file"]
    force = request.form.get("force")
    count = countWhitelist() if _list.lower() == "whitelist" else countBlacklist()
    if (count == 0) | (not count) | (force == "f"):
        if _list.lower() == "whitelist":
            dropWhitelist()
            importWhitelist(file.stream)
        else:
            dropBlacklist()
            importBlacklist(file.stream)
        status = _list[0] + "l_imported"
    else:
        status = _list[0] + "l_already_filled"
    return render_template("admin.html", status=status, **adminInfo())
Exemple #9
0
 def api_admin_drop_blacklist(self):
     return bl.dropBlacklist()
Exemple #10
0
 def api_admin_drop_blacklist(self):
   return bl.dropBlacklist()