aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Vitkov <alexvitkov98@gmail.com>2021-02-15 11:50:31 +0200
committerAlex Vitkov <alexvitkov98@gmail.com>2021-02-15 11:50:31 +0200
commit66f4891f63f0bbd58bf6da82e409512788a02983 (patch)
treea5aca9cd0a596df3ff8fec00c29c97d0d24f8e73
parentda7b9b5455c46abcab2d093147b21430ee42683a (diff)
downloadfileup-66f4891f63f0bbd58bf6da82e409512788a02983.tar.gz
Respecting write permissions
-rw-r--r--loggedin.js10
-rw-r--r--php/database.php2
2 files changed, 8 insertions, 4 deletions
diff --git a/loggedin.js b/loggedin.js
index 03a1011..8c923b4 100644
--- a/loggedin.js
+++ b/loggedin.js
@@ -5,9 +5,9 @@ var FORM_ASYNC = true;
// A FileView is an entry inside the explorer window
class FileView {
- constructor(filename, visuals, mimetype, is_directory, write_permissions) {
+ constructor(filename, mimetype, is_directory, write_permissions) {
this.filename = filename;
- this.visuals = visuals; // The DOM object with the icon and the filenam text
+ this.visuals = null; // The DOM object with the icon and the filenam text
this.mimetype = mimetype;
this.is_directory = is_directory;
this.write_permissions = write_permissions;
@@ -397,12 +397,16 @@ function opendir() {
files = [];
var json = JSON.parse(xhr.responseText);
+ console.log(json);
if (!json)
return;
// Create the FileViews from the json response
for (const f of json) {
- var view = new FileView(f.name, null, f.mimetype, f.is_directory && f.is_directory != "0", true);
+ var view = new FileView(f.name,
+ f.mimetype,
+ f.is_directory && f.is_directory != "0",
+ f.can_edit && f.can_edit != "0");
files.push(view);
}
diff --git a/php/database.php b/php/database.php
index 9d1f782..1be9059 100644
--- a/php/database.php
+++ b/php/database.php
@@ -128,7 +128,7 @@ require_once "node.php";
nodes.code as code,
nodes.type as mimetype,
node_access.can_view as can_view,
- node_access.can_view as can_eddit
+ node_access.can_edit as can_edit
from node_links
inner join nodes on
nodes.node_id=node_links.node_id