Fixed and improved server file storage
Ylian Saint-Hilaire committed
Jun 19, 2018 at 12:25 UTC
c6c9d9006650e50c3ad9e0fca9d0a6117f12ba3b
7 files changed
+40
-15
meshuser.js
+3
-1
@@ -37,6 +37,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain) {
37
} else if (splitid[0] == 'mesh') {
38
// Check mesh access
39
var meshrights = user.links[meshpath[0]];
40
+ if (meshrights == null) return null; // No meth rights for this user
41
+ meshrights = meshrights.rights; // Get the rights bit mask
42
if ((meshrights == null) || ((meshrights & 32) == 0)) return null; // This user must have mesh rights to "server files"
43
} else return null;
44
var rootfolder = meshpath[0], rootfoldersplit = rootfolder.split('/'), domainx = 'domain';
@@ -1283,7 +1285,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain) {
1285
var mesh = obj.parent.meshes[i];
1286
if (mesh) {
1287
var meshsplit = mesh._id.split('/');
1286
- files.filetree.f[mesh._id] = { t: 1, n: mesh.name, f: {} };
1288
+ files.filetree.f[mesh._id] = { t: 4, n: mesh.name, f: {} };
1289
files.filetree.f[mesh._id].maxbytes = obj.parent.getQuota(mesh._id, domain);
1290
1291
// Read all files recursively
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.1.8-e",
3
+ "version": "0.1.8-f",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",
public/images/MeshIcon100.png
Binary files /dev/null and b/public/images/MeshIcon100.png differ
public/images/meshicon16.png
Binary files /dev/null and b/public/images/meshicon16.png differ
public/styles/style.css
+10
@@ -278,6 +278,16 @@ a {
278
margin-top: 1px;
279
}
280
281
+.fileIcon4 {
282
+ background: url(../images/meshicon16.png);
283
+ height: 16px;
284
+ width: 16px;
285
+ cursor: pointer;
286
+ border: none;
287
+ float: left;
288
+ margin-top: 1px;
289
+}
290
+
291
.filelist {
292
-moz-user-select: none;
293
-khtml-user-select: none;
views/default-mobile.handlebars
+21
-8
@@ -86,6 +86,16 @@
86
margin-top: 1px;
87
}
88
89
+ .fileIcon4 {
90
+ background: url(../images/meshicon16.png);
91
+ height: 16px;
92
+ width: 16px;
93
+ cursor: pointer;
94
+ border: none;
95
+ float: left;
96
+ margin-top: 1px;
97
+ }
98
+
99
.filelist {
100
-moz-user-select: none;
101
-khtml-user-select: none;
@@ -233,8 +243,11 @@
243
-->
244
<span id="p5files"></span>
245
</div>
236
- <table id="p5toolbarBottom" style="width:100%;height:22px;position:absolute;bottom:0px" cellpadding=0 cellspacing=0>
237
- <tr><td style="text-align:left;padding:3px;text-align:center;background-color:#D3D9D6"> <span id="p5bottomstatus"></span></td></tr>
246
+ <table id="p5toolbarBottom" style="width:100%;height:22px;position:absolute;bottom:0px;background-color:#D3D9D6" cellpadding=0 cellspacing=0>
247
+ <tr>
248
+ <td style="text-align:left;padding:3px"> <span id="p5bottomstatus"></span></td>
249
+ <td id="p5rightOfButtons" style="text-align:right;padding:3px"></td>
250
+ </tr>
251
</table>
252
</div>
253
</div>
@@ -1013,8 +1026,8 @@
1026
if (f.s != null) { fsize = getFileSizeStr(f.s); }
1027
1028
var h = '';
1016
- if (f.t < 3) {
1017
- var right = (f.t == 1)?p5getQuotabar(f):'', title = '';
1029
+ if (f.t < 3 || f.t == 4) {
1030
+ var right = (f.t == 1 || f.t == 4)?p5getQuotabar(f):'', title = '';
1031
h = "<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='" + name + "'> <span style=float:right;padding-right:4px title=\"" + title + "\">" + right + "</span><span><div class=fileIcon" + f.t + "></div><a style=cursor:pointer onclick=p5folderset(\"" + encodeURIComponent(f.nx) + "\")>" + shortname + "</a></span></div>";
1032
} else {
1033
var link = shortname;
@@ -1028,7 +1041,7 @@
1041
}
1042
1043
//if (f.parent == null) { }
1031
- //QH('p5rightOfButtons', p5getQuotabar(filetreex));
1044
+ QH('p5rightOfButtons', p5getQuotabar(filetreex));
1045
1046
QH('p5files', html1 + html2);
1047
QH('p5currentpath', displayPath);
@@ -1047,8 +1060,8 @@
1060
}
1061
1062
function p5getQuotabar(f) {
1050
- while (f.t > 1) { f = f.parent; }
1051
- if ((f.t != 1) || (f.maxbytes == null)) return '';
1063
+ while (f.t > 1 && f.t != 4) { f = f.parent; }
1064
+ if ((f.t != 1 && f.t != 4) || (f.maxbytes == null)) return '';
1065
var tf = Math.floor(f.s / 1024), tq = Math.floor((f.maxbytes - f.s) / 1024);
1066
return '<span title="' + tf + "k in " + f.c + " file" + (f.c > 1?'s':'') + ". " + (Math.floor(f.maxbytes / 1024)) + 'k maxinum">' + ((tq < 0)?('Storage limit exceed'):(tq + 'k remaining')) + ' <progress style=height:10px;width:100px value=' + f.s + ' max=' + f.maxbytes + ' /></span>';
1067
}
@@ -1081,7 +1094,7 @@
1094
Q('p5SelectAllButton').value = (cc > 0 ? 'Select None' : 'Select All');
1095
QE('p5CutButton', (sfc > 0) && (cc == sfc));
1096
QE('p5CopyButton', (sfc > 0) && (cc == sfc));
1084
- QE('p5PasteButton', (p5clipboard != null) && (p5clipboard.length > 0));
1097
+ QE('p5PasteButton', (p5clipboard != null) && (p5clipboard.length > 0) && (filetreelocation.length > 0));
1098
}
1099
1100
function getFileSelCount(includeDirs) { var cc = 0; var checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && ((includeDirs != false) || (checkboxes[i].attributes.file.value == "3"))) cc++; } return cc; }
views/default.handlebars
+5
-5
@@ -4899,8 +4899,8 @@
4899
if (f.s != null) { fsize = getFileSizeStr(f.s); }
4900
4901
var h = '';
4902
- if (f.t < 3) {
4903
- var right = (f.t == 1)?p5getQuotabar(f):'', title = '';
4902
+ if (f.t < 3 || f.t == 4) {
4903
+ var right = (f.t == 1 || f.t == 4)?p5getQuotabar(f):'', title = '';
4904
h = "<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='" + name + "'> <span style=float:right title=\"" + title + "\">" + right + "</span><span><div class=fileIcon" + f.t + "></div><a style=cursor:pointer onclick=p5folderset(\"" + encodeURIComponent(f.nx) + "\")>" + shortname + "</a></span></div>";
4905
} else {
4906
var link = shortname;
@@ -4933,8 +4933,8 @@
4933
}
4934
4935
function p5getQuotabar(f) {
4936
- while (f.t > 1) { f = f.parent; }
4937
- if ((f.t != 1) || (f.maxbytes == null)) return '';
4936
+ while (f.t > 1 && f.t != 4) { f = f.parent; }
4937
+ if ((f.t != 1 && f.t != 4) || (f.maxbytes == null)) return '';
4938
var tf = Math.floor(f.s / 1024), tq = Math.floor((f.maxbytes - f.s) / 1024);
4939
return '<span title="' + tf + "k in " + f.c + " file" + (f.c > 1?'s':'') + ". " + (Math.floor(f.maxbytes / 1024)) + 'k maxinum">' + ((tq < 0)?('Storage limit exceed'):(tq + 'k remaining')) + ' <progress style=height:10px;width:100px value=' + f.s + ' max=' + f.maxbytes + ' /></span>';
4940
}
@@ -4967,7 +4967,7 @@
4967
Q('p5SelectAllButton').value = (cc > 0 ? 'Select None' : 'Select All');
4968
QE('p5CutButton', (sfc > 0) && (cc == sfc));
4969
QE('p5CopyButton', (sfc > 0) && (cc == sfc));
4970
- QE('p5PasteButton', (p5clipboard != null) && (p5clipboard.length > 0));
4970
+ QE('p5PasteButton', (p5clipboard != null) && (p5clipboard.length > 0) && (filetreelocation.length > 0));
4971
}
4972
4973
function getFileSelCount(includeDirs) { var cc = 0; var checkboxes = document.getElementsByName('fc'); for (var i = 0; i < checkboxes.length; i++) { if ((checkboxes[i].checked) && ((includeDirs != false) || (checkboxes[i].attributes.file.value == "3"))) cc++; } return cc; }