Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const subscription = session.getSubscription(subscriptionId);
if (!subscription) {
// subscription may belongs to a different session that ours
if (engine.findSubscription(subscriptionId)) {
// if yes, then access to Subscription data should be denied
return callback(null, {statusCode: StatusCodes.BadUserAccessDenied});
}
return callback(null, {statusCode: StatusCodes.BadSubscriptionIdInvalid});
}
const result = subscription.getMonitoredItems();
assert(result.statusCode);
assert(_.isArray(result.serverHandles));
assert(_.isArray(result.clientHandles));
assert(result.serverHandles.length === result.clientHandles.length);
const callMethodResult = new CallMethodResult({
statusCode: result.statusCode,
outputArguments: [
{dataType: DataType.UInt32, arrayType: VariantArrayType.Array, value: result.serverHandles},
{dataType: DataType.UInt32, arrayType: VariantArrayType.Array, value: result.clientHandles}
]
});
callback(null, callMethodResult);
}
const subscription = session.getSubscription(subscriptionId);
if (!subscription) {
// subscription may belongs to a different session that ours
if (engine.findSubscription(subscriptionId)) {
// if yes, then access to Subscription data should be denied
return callback(null, { statusCode: StatusCodes.BadUserAccessDenied });
}
return callback(null, { statusCode: StatusCodes.BadSubscriptionIdInvalid });
}
const result = subscription.getMonitoredItems();
assert(result.statusCode);
assert(_.isArray(result.serverHandles));
assert(_.isArray(result.clientHandles));
assert(result.serverHandles.length === result.clientHandles.length);
const callMethodResult = new CallMethodResult({
statusCode: result.statusCode,
outputArguments: [
{ dataType: DataType.UInt32, arrayType: VariantArrayType.Array, value: result.serverHandles },
{ dataType: DataType.UInt32, arrayType: VariantArrayType.Array, value: result.clientHandles }
]
});
callback(null, callMethodResult);
}