Esempio n. 1
0
    def delete(self, project_id, entry, entry_id):
        api_key = request.args.get("api_key")
        if not authorized(api_key, project_id):
            return jsonify({"status": False})

        # if project not in user.user.project:
        #    return jsonify({'status':False})

        id = objectid.ObjectId(str(entry_id))

        project = Project()
        project.get(project_id)
        model = project.get_entry_collection(entry)
        model.delete({"_id": id})
        project.entry_updated()
        return jsonify({"status": True})
Esempio n. 2
0
    def post(self, project_id, entry):
        api_key = request.args.get("api_key")

        if not authorized(api_key, project_id):
            return jsonify({"status": False, "message": "user is not authenticated"})

        # Lets disable it for now. Until flask-principal is implemented
        # if project not in user.user.project:
        #    return jsonify({'status':False,'message':'user don nott have access to project'})

        project = Project()
        project.get(project_id)
        model = project.get_entry_collection(entry)

        model.insert(request.json)
        project.entry_updated()
        return jsonify({"status": True})