Skip to content

Commit

Permalink
version alpha-0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Viterbo committed Jun 8, 2015
1 parent e5aff39 commit 0a0e81c
Show file tree
Hide file tree
Showing 3 changed files with 544 additions and 0 deletions.
72 changes: 72 additions & 0 deletions drive-acl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,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;
});
66 changes: 66 additions & 0 deletions drive-aux.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
define([
"jwebkit",
"jwebdesk"
], function(jwk, jwebdesk) {

function AUXDrive () {
jwk.Node.call(this);
}

AUXDrive.prototype = new jwebdesk.Drive();
AUXDrive.prototype.constructor = AUXDrive;


// -------------------------------------------------------------------------------------------

AUXDrive.prototype.assert_acls = function (node) {

return jwk.Deferred().resolve(self, this._owner).promise();
}

AUXDrive.prototype.login = function (do_popup) {}

AUXDrive.prototype.logout = function () { }

AUXDrive.prototype.user = function () {}

AUXDrive.prototype.root = function () {}

AUXDrive.prototype.writeFile = function (node, data, params) {
return this.assert_acls(node).then(function (self, drive){
return drive.writeFile(node, data, params);
});
}

AUXDrive.prototype.readFile = function (node) {
return this.assert_acls(node).then(function (self, drive){
return drive.readFile(node);
});
}

AUXDrive.prototype.readdir = function (node) {
return this.assert_acls(node).then(function (self, drive){
return drive.readdir(node);
});
}

AUXDrive.prototype.createChild = function (node, entry) {
return this.assert_acls(node).then(function (self, drive){
return drive.createChild(node, entry);
});
}

AUXDrive.prototype.link = function (node) {
return this.assert_acls(node).then(function (self, drive){
return drive.link(node);
});
}

AUXDrive.prototype.thumbnail = function () {
return this.assert_acls(node).then(function (self, drive){
return drive.thumbnail(node);
});
}

return AUXDrive;
});
Loading

0 comments on commit 0a0e81c

Please sign in to comment.