From 3e0f30bddef185db6617cd67283c45eccd071e8d Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Thu, 4 Aug 2011 17:40:51 +0100 Subject: [PATCH] added getReadOnlyID --- node/db/API.js | 19 +++++++++++++++++-- node/handler/APIHandler.js | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/node/db/API.js b/node/db/API.js index 6bfc4f420..8d19dab35 100644 --- a/node/db/API.js +++ b/node/db/API.js @@ -20,6 +20,7 @@ var padManager = require("./PadManager"); var padMessageHandler = require("../handler/PadMessageHandler"); +var readOnlyManager = require("./ReadOnlyManager"); var async = require("async"); /**********************/ @@ -404,9 +405,23 @@ Example returns: {code: 0, message:"ok", data: null} {code: 1, message:"padID does not exist", data: null} */ -exports.getReadOnlyLink = function(padID, callback) +exports.getReadOnlyID = function(padID, callback) { - + //we don't need the pad object, but this function does all the security stuff for us + getPadSafe(padID, function(err) + { + if(err) + { + callback(err); + return; + } + + //get the readonlyId + readOnlyManager.getReadOnlyId(padID, function(err, readOnlyId) + { + callback(err, {readOnlyID: readOnlyId}); + }); + }); } /** diff --git a/node/handler/APIHandler.js b/node/handler/APIHandler.js index 8cb9e9c89..46733bfcd 100644 --- a/node/handler/APIHandler.js +++ b/node/handler/APIHandler.js @@ -53,7 +53,7 @@ var functions = { "setText" : ["padID", "text"], "getRevisionsCount" : ["padID"], // "deletePad" : ["padID"], -// "getReadOnlyLink" : ["padID"], + "getReadOnlyID" : ["padID"], // "setPublicStatus" : ["padID", "publicStatus"], // "getPublicStatus" : ["padID"], // "setPassword" : ["padID", "password"],