Replace auth.js script with config expression

This commit is contained in:
Zaid Abdulla committed 2019-03-15 02:21:46 -07:00
1 parent 6c6d88e88b
commit 2c9e7e8e29
8 files changed
+283 -237

No files matched your search

+9 -1
View File
@@ -530,7 +530,8 @@ export function getConfig(
"cwmp.connectionRequestAllowBasicAuth":
"CONNECTION_REQUEST_ALLOW_BASIC_AUTH",
"cwmp.maxCommitIterations": "MAX_COMMIT_ITERATIONS",
"cwmp.deviceOnlineThreshold": "DEVICE_ONLINE_THRESHOLD"
"cwmp.deviceOnlineThreshold": "DEVICE_ONLINE_THRESHOLD",
"cwmp.udpConnectionRequestPort": "UDP_CONNECTION_REQUEST_PORT"
};
if (!(key in snapshot.config)) {
@@ -541,6 +542,13 @@ export function getConfig(
return expression.evaluate(snapshot.config[key], context, now || Date.now());
}
export function getConfigExpression(snapshotKey, key): Expression {
const snapshot = snapshots.get(snapshotKey);
if (!snapshot) throw new Error("Cache snapshot does not exist");
return snapshot.config[key];
}
export function getUsers(snapshotKey): {} {
const snapshot = snapshots.get(snapshotKey);
if (!snapshot) throw new Error("Cache snapshot does not exist");