summaryrefslogtreecommitdiff
path: root/node/db
diff options
context:
space:
mode:
authorPeter 'Pita' Martischka <petermartischka@googlemail.com>2011-08-16 18:17:46 +0100
committerPeter 'Pita' Martischka <petermartischka@googlemail.com>2011-08-16 18:17:46 +0100
commit783c192726cf8998a445849e110839eb51cd3be4 (patch)
tree95766d5bdceae554ae15fd7aa0f6d690521fc5f6 /node/db
parent1151ec32787c89308b1d69a93ed6f02ccbc68d41 (diff)
downloadetherpad-lite-783c192726cf8998a445849e110839eb51cd3be4.zip
ensure password and publicStatus functions are only used with group pads
Diffstat (limited to 'node/db')
-rw-r--r--node/db/API.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/node/db/API.js b/node/db/API.js
index 1fd1bb7b..acce6485 100644
--- a/node/db/API.js
+++ b/node/db/API.js
@@ -280,6 +280,13 @@ Example returns:
*/
exports.setPublicStatus = function(padID, publicStatus, callback)
{
+ //ensure this is a group pad
+ if(padID.indexOf("$") == -1)
+ {
+ callback({stop: "You can only get/set the publicStatus of pads that belong to a group"});
+ return;
+ }
+
//get the pad
getPadSafe(padID, true, function(err, pad)
{
@@ -310,6 +317,13 @@ Example returns:
*/
exports.getPublicStatus = function(padID, callback)
{
+ //ensure this is a group pad
+ if(padID.indexOf("$") == -1)
+ {
+ callback({stop: "You can only get/set the publicStatus of pads that belong to a group"});
+ return;
+ }
+
//get the pad
getPadSafe(padID, true, function(err, pad)
{
@@ -333,6 +347,13 @@ Example returns:
*/
exports.setPassword = function(padID, password, callback)
{
+ //ensure this is a group pad
+ if(padID.indexOf("$") == -1)
+ {
+ callback({stop: "You can only get/set the password of pads that belong to a group"});
+ return;
+ }
+
//get the pad
getPadSafe(padID, true, function(err, pad)
{
@@ -359,6 +380,13 @@ Example returns:
*/
exports.isPasswordProtected = function(padID, callback)
{
+ //ensure this is a group pad
+ if(padID.indexOf("$") == -1)
+ {
+ callback({stop: "You can only get/set the password of pads that belong to a group"});
+ return;
+ }
+
//get the pad
getPadSafe(padID, true, function(err, pad)
{