mirror of
https://github.com/Telecominfraproject/ols-ucentral-schema.git
synced 2025-11-02 11:08:00 +00:00
add developer=1 override option for locked units
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
@@ -4,8 +4,14 @@ let uci = require("uci");
|
|||||||
let ubus = require("ubus");
|
let ubus = require("ubus");
|
||||||
let capabfile = fs.open("/etc/ucentral/capabilities.json", "r");
|
let capabfile = fs.open("/etc/ucentral/capabilities.json", "r");
|
||||||
let capab = json(capabfile.read("all"));
|
let capab = json(capabfile.read("all"));
|
||||||
let restrictfile = fs.open("/etc/ucentral/restrictions.json", "r");
|
let pipe = fs.popen('fw_printenv developer');
|
||||||
let restrict = restrictfile ? json(restrictfile.read("all")) : null;
|
let developer = replace(pipe.read("all"), '\n', '');
|
||||||
|
pipe.close();
|
||||||
|
let restrict = {};
|
||||||
|
if (developer != 'developer=1') {
|
||||||
|
let restrictfile = fs.open("/etc/ucentral/restrictions.json", "r");
|
||||||
|
restrict = restrictfile ? json(restrictfile.read("all")) : {};
|
||||||
|
}
|
||||||
let cmdfile = fs.open(ARGV[0], "r");
|
let cmdfile = fs.open(ARGV[0], "r");
|
||||||
let cmd = json(cmdfile.read("all"));
|
let cmd = json(cmdfile.read("all"));
|
||||||
let id = ARGV[1];
|
let id = ARGV[1];
|
||||||
|
|||||||
@@ -12,8 +12,14 @@ let conn = ubus ? ubus.connect() : null;
|
|||||||
let capabfile = fs.open("/etc/ucentral/capabilities.json", "r");
|
let capabfile = fs.open("/etc/ucentral/capabilities.json", "r");
|
||||||
let capab = capabfile ? json(capabfile.read("all")) : null;
|
let capab = capabfile ? json(capabfile.read("all")) : null;
|
||||||
|
|
||||||
let restrictfile = fs.open("/etc/ucentral/restrictions.json", "r");
|
let pipe = fs.popen('fw_printenv developer');
|
||||||
let restrict = restrictfile ? json(restrictfile.read("all")) : {};
|
let developer = replace(pipe.read("all"), '\n', '');
|
||||||
|
pipe.close();
|
||||||
|
let restrict = {};
|
||||||
|
if (developer != 'developer=1') {
|
||||||
|
let restrictfile = fs.open("/etc/ucentral/restrictions.json", "r");
|
||||||
|
restrict = restrictfile ? json(restrictfile.read("all")) : {};
|
||||||
|
}
|
||||||
|
|
||||||
let serial = cursor.get("ucentral", "config", "serial");
|
let serial = cursor.get("ucentral", "config", "serial");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user