-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrive-acl.js
72 lines (56 loc) · 2.11 KB
/
drive-acl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
define([
"jwebkit",
"jwebdesk"
], function(jwk, jwebdesk) {
function ACLDrive (apptoken, acl, owner) {
this._owner = owner;
this._acl = acl;
jwebdesk.Drive.call(this, apptoken, {
title: "ACLDrive",
id: owner.get("id")
});
}
ACLDrive.prototype = new jwebdesk.Drive();
ACLDrive.prototype.constructor = ACLDrive;
// -------------------------------------------------------------------------------------------
ACLDrive.prototype.assert_acls = function (node, access) {
var path = node.path;
console.error("ACLDrive.prototype.assert_acls--->", node, this._acl);
return jwk.Deferred().resolve(self, this._owner).promise();
}
ACLDrive.prototype.login = function (do_popup) {}
ACLDrive.prototype.logout = function () { }
ACLDrive.prototype.user = function () {}
ACLDrive.prototype.root = function () {}
ACLDrive.prototype.writeFile = function (node, data, params) {
return this.assert_acls(node, "w").then(function (self, drive){
return drive.writeFile(node, data, params);
});
}
ACLDrive.prototype.readFile = function (node) {
return this.assert_acls(node, "r").then(function (self, drive){
return drive.readFile(node);
});
}
ACLDrive.prototype.readdir = function (node) {
return this.assert_acls(node, "r").then(function (self, drive){
return drive.readdir(node);
});
}
ACLDrive.prototype.createChild = function (node, entry) {
return this.assert_acls(node, "w").then(function (self, drive){
return drive.createChild(node, entry);
});
}
ACLDrive.prototype.link = function (node) {
return this.assert_acls(node, "r").then(function (self, drive){
return drive.link(node);
});
}
ACLDrive.prototype.thumbnail = function () {
return this.assert_acls(node, "r").then(function (self, drive){
return drive.thumbnail(node);
});
}
return ACLDrive;
});