Fixed and improved server file storage

This commit is contained in:
Ylian Saint-Hilaire 2018-06-19 12:25:57 -07:00
parent 2850340a7d
commit c6c9d90066
7 changed files with 40 additions and 15 deletions

View File

@ -37,6 +37,8 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain) {
} else if (splitid[0] == 'mesh') {
// Check mesh access
var meshrights = user.links[meshpath[0]];
if (meshrights == null) return null; // No meth rights for this user
meshrights = meshrights.rights; // Get the rights bit mask
if ((meshrights == null) || ((meshrights & 32) == 0)) return null; // This user must have mesh rights to "server files"
} else return null;
var rootfolder = meshpath[0], rootfoldersplit = rootfolder.split('/'), domainx = 'domain';
@ -1283,7 +1285,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain) {
var mesh = obj.parent.meshes[i];
if (mesh) {
var meshsplit = mesh._id.split('/');
files.filetree.f[mesh._id] = { t: 1, n: mesh.name, f: {} };
files.filetree.f[mesh._id] = { t: 4, n: mesh.name, f: {} };
files.filetree.f[mesh._id].maxbytes = obj.parent.getQuota(mesh._id, domain);
// Read all files recursively

View File

@ -1,6 +1,6 @@
{
"name": "meshcentral",
"version": "0.1.8-e",
"version": "0.1.8-f",
"keywords": [
"Remote Management",
"Intel AMT",

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

View File

@ -278,6 +278,16 @@ a {
margin-top: 1px;
}
.fileIcon4 {
background: url(../images/meshicon16.png);
height: 16px;
width: 16px;
cursor: pointer;
border: none;
float: left;
margin-top: 1px;
}
.filelist {
-moz-user-select: none;
-khtml-user-select: none;

View File

@ -86,6 +86,16 @@
margin-top: 1px;
}
.fileIcon4 {
background: url(../images/meshicon16.png);
height: 16px;
width: 16px;
cursor: pointer;
border: none;
float: left;
margin-top: 1px;
}
.filelist {
-moz-user-select: none;
-khtml-user-select: none;
@ -233,8 +243,11 @@
-->
<span id="p5files"></span>
</div>
<table id="p5toolbarBottom" style="width:100%;height:22px;position:absolute;bottom:0px" cellpadding=0 cellspacing=0>
<tr><td style="text-align:left;padding:3px;text-align:center;background-color:#D3D9D6">&nbsp;<span id="p5bottomstatus"></span></td></tr>
<table id="p5toolbarBottom" style="width:100%;height:22px;position:absolute;bottom:0px;background-color:#D3D9D6" cellpadding=0 cellspacing=0>
<tr>
<td style="text-align:left;padding:3px">&nbsp;<span id="p5bottomstatus"></span></td>
<td id="p5rightOfButtons" style="text-align:right;padding:3px"></td>
</tr>
</table>
</div>
</div>
@ -1013,8 +1026,8 @@
if (f.s != null) { fsize = getFileSizeStr(f.s); }
var h = '';
if (f.t < 3) {
var right = (f.t == 1)?p5getQuotabar(f):'', title = '';
if (f.t < 3 || f.t == 4) {
var right = (f.t == 1 || f.t == 4)?p5getQuotabar(f):'', title = '';
h = "<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='" + name + "'>&nbsp;<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>";
} else {
var link = shortname;
@ -1028,7 +1041,7 @@
}
//if (f.parent == null) { }
//QH('p5rightOfButtons', p5getQuotabar(filetreex));
QH('p5rightOfButtons', p5getQuotabar(filetreex));
QH('p5files', html1 + html2);
QH('p5currentpath', displayPath);
@ -1047,8 +1060,8 @@
}
function p5getQuotabar(f) {
while (f.t > 1) { f = f.parent; }
if ((f.t != 1) || (f.maxbytes == null)) return '';
while (f.t > 1 && f.t != 4) { f = f.parent; }
if ((f.t != 1 && f.t != 4) || (f.maxbytes == null)) return '';
var tf = Math.floor(f.s / 1024), tq = Math.floor((f.maxbytes - f.s) / 1024);
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>';
}
@ -1081,7 +1094,7 @@
Q('p5SelectAllButton').value = (cc > 0 ? 'Select None' : 'Select All');
QE('p5CutButton', (sfc > 0) && (cc == sfc));
QE('p5CopyButton', (sfc > 0) && (cc == sfc));
QE('p5PasteButton', (p5clipboard != null) && (p5clipboard.length > 0));
QE('p5PasteButton', (p5clipboard != null) && (p5clipboard.length > 0) && (filetreelocation.length > 0));
}
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; }

View File

@ -4899,8 +4899,8 @@
if (f.s != null) { fsize = getFileSizeStr(f.s); }
var h = '';
if (f.t < 3) {
var right = (f.t == 1)?p5getQuotabar(f):'', title = '';
if (f.t < 3 || f.t == 4) {
var right = (f.t == 1 || f.t == 4)?p5getQuotabar(f):'', title = '';
h = "<div class=filelist file=999><input file=999 style=float:left name=fc class=fcb type=checkbox onchange=p5setActions() value='" + name + "'>&nbsp;<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>";
} else {
var link = shortname;
@ -4933,8 +4933,8 @@
}
function p5getQuotabar(f) {
while (f.t > 1) { f = f.parent; }
if ((f.t != 1) || (f.maxbytes == null)) return '';
while (f.t > 1 && f.t != 4) { f = f.parent; }
if ((f.t != 1 && f.t != 4) || (f.maxbytes == null)) return '';
var tf = Math.floor(f.s / 1024), tq = Math.floor((f.maxbytes - f.s) / 1024);
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>';
}
@ -4967,7 +4967,7 @@
Q('p5SelectAllButton').value = (cc > 0 ? 'Select None' : 'Select All');
QE('p5CutButton', (sfc > 0) && (cc == sfc));
QE('p5CopyButton', (sfc > 0) && (cc == sfc));
QE('p5PasteButton', (p5clipboard != null) && (p5clipboard.length > 0));
QE('p5PasteButton', (p5clipboard != null) && (p5clipboard.length > 0) && (filetreelocation.length > 0));
}
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; }