Add plugin "type" to plugins (permission sets coming soon)
This commit is contained in:
parent
06cbf93934
commit
6d3673a858
4
db.js
4
db.js
|
@ -753,10 +753,10 @@ module.exports.CreateDB = function (parent, func) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a plugin
|
// Add a plugin
|
||||||
obj.addPlugin = function (plugin, func) { obj.pluginsfile.insertOne(plugin, func); };
|
obj.addPlugin = function (plugin, func) { plugin.type = "plugin"; obj.pluginsfile.insertOne(plugin, func); };
|
||||||
|
|
||||||
// Get all plugins
|
// Get all plugins
|
||||||
obj.getPlugins = function (func) { obj.pluginsfile.find().sort({ name: 1 }).toArray(func); };
|
obj.getPlugins = function (func) { obj.pluginsfile.find({"type": "plugin"}).project({"type": 0}).sort({ name: 1 }).toArray(func); };
|
||||||
|
|
||||||
// Get plugin
|
// Get plugin
|
||||||
obj.getPlugin = function (id, func) { id = require('mongodb').ObjectID(id); obj.pluginsfile.find({ _id: id }).sort({ name: 1 }).toArray(func); };
|
obj.getPlugin = function (id, func) { id = require('mongodb').ObjectID(id); obj.pluginsfile.find({ _id: id }).sort({ name: 1 }).toArray(func); };
|
||||||
|
|
|
@ -3113,7 +3113,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'plugins': {
|
case 'plugins': {
|
||||||
// @Ylianst - Do we need a new permission set here?
|
// Since plugin actions generally require a server restart, use the Full admin permission
|
||||||
if ((user.siteadmin & 0xFFFFFFFF) == 0 || parent.parent.pluginHandler == null) break; // must be full admin with plugins enabled
|
if ((user.siteadmin & 0xFFFFFFFF) == 0 || parent.parent.pluginHandler == null) break; // must be full admin with plugins enabled
|
||||||
parent.db.getPlugins(function(err, docs) {
|
parent.db.getPlugins(function(err, docs) {
|
||||||
try { ws.send(JSON.stringify({ action: 'updatePluginList', list: docs, result: err })); } catch (ex) { }
|
try { ws.send(JSON.stringify({ action: 'updatePluginList', list: docs, result: err })); } catch (ex) { }
|
||||||
|
|
Loading…
Reference in New Issue