def insert_test_data(): """ checks if dev/test db has magic user, otherwise insert it""" magic_user = get_magic_user() ctx = app.data.driver.db['user'] user = ctx.find_one({"fbId": magic_user["fbId"]}) if user: ctx.update({'_id': user['_id']}, magic_user) else: user_id = ctx.insert(magic_user) user = ctx.find_one({'_id': user_id}) #resp = json.dumps({"user": user}, cls=Encoder) resp = jsonify({"user": user}) return make_response(resp)
def check_auth(self, fb_id, cf_token, allowed_roles, resource, method): magic_user = get_magic_user() if fb_id == magic_user["fbId"] and cf_token == magic_user["cfToken"]: return True return False