Exemplo n.º 1
0
def setting(name):
    if request.method == "GET":
        result = Settings().get_setting(name)
        return output_success(result)
    elif request.method == "POST":
        post_data = request.get_json()
        Settings().set_setting(name, post_data["value"])
        return output_success("ok")
Exemplo n.º 2
0
def exclusion():
    exc = Exclusion()
    if request.method == "GET":
        result = exc.list()
        return output_success(result)
    elif request.method == "PUT":
        data = request.get_json()
        exc.add(data)
        result = exc.list()
        return output_success(result)
    elif request.method == "POST":
        data = request.get_json()
        exc.update(data)
        result = exc.list()
        return output_success(result)
Exemplo n.º 3
0
def check_entry(entry_type, domain, name):
    entry = Entry(domain)
    result = entry.check_entry(entry_type, name)
    if result:
        return output_success(result)
    else:
        return output_error(1, "no such entry"), 404
Exemplo n.º 4
0
def test_ldap_con():
    post_data = request.get_json()
    setting = post_data["setting"]
    domain = list(setting.keys())[0]
    server = Server(setting[domain]["server"], get_info=ALL)
    try:
        con = Connection(server, user=setting[domain]["user"], password=setting[domain]["password"], auto_bind=True)
        return output_success("ok")
    except Exception as e:
        return output_error(2, str(e)), 500
Exemplo n.º 5
0
def delete_exclusion(_id):
    exc = Exclusion()
    exc.delete(_id)
    result = exc.list()
    return output_success(result)