Commit 5ccc2bd8 authored by lucas.parsy's avatar lucas.parsy Committed by Romain Courteaud

added mode option at dropbox storage creation

allowing to choose between "dropbox" (access to full dropbox account)
and "sandbox" (cannot access files not created by the jio application)
mode.
parent e9536fab
......@@ -93,7 +93,8 @@
// type: "drivetojiomapping",
// sub_storage: {
// "type": "dropbox",
// "access_token" : "TOKEN"
// "access_token" : "TOKEN",
// "root" : "dropbox"
// }
// }
// }
......
......@@ -49,8 +49,12 @@
throw new TypeError("Access Token' must be a string " +
"which contains more than one character.");
}
if (typeof spec.root !== 'string' || !spec.root ||
(spec.root !== "dropbox" && spec.root !== "sandbox")) {
throw new TypeError("root must be 'dropbox' or 'sandbox'");
}
this._access_token = spec.access_token;
this._root = "dropbox";
this._root = spec.root;
}
DropboxStorage.prototype.put = function (id, param) {
......
......@@ -20,7 +20,8 @@
test("create storage", function () {
var jio = jIO.createJIO({
type: "dropbox",
access_token: token
access_token: token,
root : "dropbox"
});
equal(jio.__type, "dropbox");
deepEqual(jio.__storage._access_token, token);
......@@ -38,7 +39,8 @@
this.jio = jIO.createJIO({
type: "dropbox",
access_token: token
access_token: token,
root : "dropbox"
});
},
teardown: function () {
......@@ -166,7 +168,8 @@
this.jio = jIO.createJIO({
type: "dropbox",
access_token: token
access_token: token,
root : "dropbox"
});
},
teardown: function () {
......@@ -264,7 +267,8 @@
this.jio = jIO.createJIO({
type: "dropbox",
access_token: token
access_token: token,
root : "dropbox"
});
},
teardown: function () {
......@@ -366,7 +370,8 @@
this.jio = jIO.createJIO({
type: "dropbox",
access_token: token
access_token: token,
root : "dropbox"
});
},
teardown: function () {
......@@ -507,7 +512,8 @@
this.jio = jIO.createJIO({
type: "dropbox",
access_token: token
access_token: token,
root : "dropbox"
});
},
teardown: function () {
......@@ -679,7 +685,8 @@
this.jio = jIO.createJIO({
type: "dropbox",
access_token: token
access_token: token,
root : "dropbox"
});
},
teardown: function () {
......@@ -840,7 +847,8 @@
this.jio = jIO.createJIO({
type: "dropbox",
access_token: token
access_token: token,
root : "dropbox"
});
},
teardown: function () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment