Ejemplo n.º 1
0
def getNotes(payload, req):
    uid = UR.getUserId(req)
    output = {}
    if "file" in payload: #access by file
        after = payload.get("after", None)
        id_source = payload["file"]
        if auth.canReadFile(uid, id_source, req):
            #output["notes"] = annotations.getNotesByFile(id_source, uid)
            output["file"] = id_source
            output["locations"], output["html5locations"], output["comments"], output["threadmarks"] = annotations.getCommentsByFile(id_source, uid, after)
            #TODO: 
            #output["links"] = annotations.get_links(uid, {"id_source": id_source})
            output["seen"] = annotations.getSeenByFile(id_source, uid)
        else:
            return UR.prepare_response({}, 1, "NOT ALLOWED")
    return UR.prepare_response(output)
Ejemplo n.º 2
0
def getNotes(payload, req):
    uid = UR.getUserId(req)
    output = {}
    if "file" in payload: #access by file
        after = payload.get("after", None)
        id_source = payload["file"]
        if auth.canReadFile(uid, id_source, req):
            #output["notes"] = annotations.getNotesByFile(id_source, uid)
            output["file"] = id_source
            output["locations"], output["html5locations"], output["comments"], output["threadmarks"] = annotations.getCommentsByFile(id_source, uid, after)
            #TODO: 
            #output["links"] = annotations.get_links(uid, {"id_source": id_source})
            output["seen"] = annotations.getSeenByFile(id_source, uid)
        else:
            return UR.prepare_response({}, 1, "NOT ALLOWED")
    return UR.prepare_response(output)