Пример #1
0
def set_harold(file_hash, auth_dict=None):
    harold_model = Harold(file_hash, auth_dict["uid"])
    db.session.add(harold_model)
    db.session.flush()
    db.session.commit()
    db.session.refresh(harold_model)
    return "OK", 200
Пример #2
0
def set_harold(file_hash, auth_dict=None):
    is_tour = request.json["tour"]
    is_rtp = ldap_is_rtp(auth_dict["uid"])
    is_eboard = ldap_is_eboard(auth_dict["uid"])
    if is_tour == "true":
        if (is_rtp or is_eboard):
            uid = "root"
        else:
            return "Not Authorized", 403
    else:
        uid = auth_dict["uid"]
    harold_model = Harold(file_hash, uid)
    db.session.add(harold_model)
    db.session.flush()
    db.session.commit()
    db.session.refresh(harold_model)
    return "OK", 200