-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathadmin.js
40 lines (33 loc) · 944 Bytes
/
admin.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
/**
* @description MeshCentral event log plugin
* @author Ryan Blenis
* @copyright
* @license Apache-2.0
*/
"use strict";
module.exports.admin = function(parent) {
var obj = {};
obj.parent = parent;
obj.meshArgs = obj.parent.parent.parent.args;
obj.util = require('util');
obj.req = function(req, res, user) {
if ((user.siteadmin & 0xFFFFFFFF) == 0) { res.sendStatus(401); return; }
var vars = {
configSets: null,
configAssignments: null
};
parent.db.getAllConfigSets()
.then((cfs) => {
vars.configSets = JSON.stringify(cfs);
})
.then(parent.db.getConfigAssignments)
.then((cfa) => {
vars.configAssignments = JSON.stringify(cfa);
res.render('admin', vars);
});
}
obj.post = function(req, res, user) {
res.sendStatus(401); return;
}
return obj;
}