Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
gpii.tests.productionConfigTesting.testGetForDeletion = function (data, request) {
var expected = request.options.expectedStatusCodes;
var actual = request.nativeResponse.statusCode;
jqUnit.assertNotEquals(
"Deleting record from database using " + request.options.path +
", status: " + actual,
expected.indexOf(actual), -1
);
// Mark and store the to-be-deleted record
if (actual === 201 || actual === 200) {
request.options.docToRemove = JSON.parse(data);
request.options.docToRemove._deleted = true;
}
fluid.log(request.options.docToRemove);
};
if (Array.isArray(value)) {
bytes.push.apply(bytes, value);
} else {
bytes.push(value);
}
}
});
var maxResponseLength = apdu.le || 0;
var data = Buffer.from(bytes);
var statusCodeLength = 2;
var successResponse = 0x9000;
fluid.log("APDU: ", data.toString("hex").replace(/(..)/g, "$1 "), apdu.text || " ");
// Send it to the card.
card.transmit(data, maxResponseLength + statusCodeLength, function (err, buf) {
if (err) {
promise.reject({
isError: true,
message: "Unable to send command to card",
error: err
});
} else {
fluid.log("Response: ", buf.toString("hex"));
if (ignoreStatusCode) {
promise.resolve(buf);
} else {
// Status code is the last 2 bytes (and cards are big endian).
var statusCode;
reader.on("error", function (e) {
// The device has gone, or is in an unknown state - restart the user listener.
fluid.log("Card reader error (" + reader.name + "): ", e.message);
that.failed(e);
});
};
gpii.tests.productionConfigTesting.testPurge = function (data, request) {
fluid.log(JSON.parse(data));
gpii.tests.productionConfigTesting.testStatusCode(data, request);
};
function (error) {
fluid.log(error);
process.exit(1);
}
);
var mapper = function (rawPrefs) {
var prefs = rawPrefs ? ontologyHandler.rawPrefsToOntology(rawPrefs, view) : undefined;
fluid.log("Preferences Server, getPreferences(), returning preferences: ", prefs);
return prefs;
};
return fluid.promise.map(rawPrefsPromise, mapper);
stopPromise.then(function (response) {
fluid.log("userLogonStateChange.logoutUser: Lifecycle manager returned: ", response);
gpii.lifecycleManager.userLogonHandling.updateLogonChangeModel(lifecycleManager, gpiiKey, "logout", false);
promiseTogo.resolve(response);
}, function (error) {
fluid.log(fluid.logLevel.FAIL, "userLogonStateChange.logoutUser: An error occurred when attempting to log out user: ", error);
gpii.accessTokens.filterExpiredAccessTokens = function (responseString, options) {
if (options.deleteAll) {
fluid.log("Deleting all access tokens...");
} else {
fluid.log("Filtering for expired access tokens...");
}
var tokens = JSON.parse(responseString);
var expiredTokens = [];
options.totalTokens = 0;
if (tokens.rows) {
fluid.each(tokens.rows, function (aRow) {
var aToken = aRow.value.authorization;
if (options.deleteAll || Date.now() > Date.parse(aToken.timestampExpires)) {
aToken._deleted = true;
expiredTokens.push(aToken);
}
options.totalTokens++;
});
options.accessTokens = expiredTokens;
}
return expiredTokens;
}, function (error) {
fluid.log("Resetting on system startup fails with the error: ", error);
resetErrorEvent.fire(error);
});
} else {