Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function _install_condition_variable_type(
node: UAConditionVariable
) {
assert(node instanceof BaseNode);
// from spec 1.03 : 5.3 condition variables
// However, a change in their value is considered important and supposed to trigger
// an Event Notification. These information elements are called ConditionVariables.
if (node.sourceTimestamp) {
node.sourceTimestamp.accessLevel = makeAccessLevelFlag("CurrentRead");
} else {
console.warn("cannot find node.sourceTimestamp", node.browseName.toString());
}
node.accessLevel = makeAccessLevelFlag("CurrentRead");
// from spec 1.03 : 5.3 condition variables
// a condition VariableType has a sourceTimeStamp exposed property
// SourceTimestamp indicates the time of the last change of the Value of this ConditionVariable.
// It shall be the same time that would be returned from the Read Service inside the DataValue
// structure for the ConditionVariable Value Attribute.
assert(node.typeDefinitionObj.browseName.toString() === "ConditionVariableType");
assert(node.sourceTimestamp.browseName.toString() === "SourceTimestamp");
node.on("value_changed", _update_sourceTimestamp);
}
function _install_condition_variable_type(
node: UAConditionVariable
) {
assert(node instanceof BaseNode);
// from spec 1.03 : 5.3 condition variables
// However, a change in their value is considered important and supposed to trigger
// an Event Notification. These information elements are called ConditionVariables.
if (node.sourceTimestamp) {
node.sourceTimestamp.accessLevel = makeAccessLevelFlag("CurrentRead");
} else {
console.warn("cannot find node.sourceTimestamp", node.browseName.toString());
}
node.accessLevel = makeAccessLevelFlag("CurrentRead");
// from spec 1.03 : 5.3 condition variables
// a condition VariableType has a sourceTimeStamp exposed property
// SourceTimestamp indicates the time of the last change of the Value of this ConditionVariable.
// It shall be the same time that would be returned from the Read Service inside the DataValue
// structure for the ConditionVariable Value Attribute.
assert(node.typeDefinitionObj.browseName.toString() === "ConditionVariableType");
assert(node.sourceTimestamp.browseName.toString() === "SourceTimestamp");
node.on("value_changed", _update_sourceTimestamp);
}
function _install_condition_variable_type(node) {
assert(node instanceof BaseNode);
// from spec 1.03 : 5.3 condition variables
// However, a change in their value is considered important and supposed to trigger
// an Event Notification. These information elements are called ConditionVariables.
if (node.sourceTimestamp) {
node.sourceTimestamp.accessLevel = makeAccessLevelFlag("CurrentRead");
} else {
console.warn("cannot find node.sourceTimestamp", node.browseName.toString());
}
node.accessLevel = makeAccessLevelFlag("CurrentRead");
// from spec 1.03 : 5.3 condition variables
// a condition VariableType has a sourceTimeStamp exposed property
// SourceTimestamp indicates the time of the last change of the Value of this ConditionVariable.
// It shall be the same time that would be returned from the Read Service inside the DataValue
// structure for the ConditionVariable Value Attribute.
assert(node.typeDefinitionObj.browseName.toString() === "ConditionVariableType");
assert(node.sourceTimestamp.browseName.toString() === "SourceTimestamp");
node.on("value_changed", _update_sourceTimestamp);
}
public checkPermission(node: BaseNode, action: string): boolean {
// tslint:disable:no-bitwise
const lNode = node as any;
assert(AccessLevelFlag.hasOwnProperty(action));
const actionFlag: number = makeAccessLevelFlag(action);
if (!lNode._permissions) {
return (lNode.userAccessLevel & actionFlag) === actionFlag;
}
const permission: string[] = lNode._permissions[action];
if (!permission) {
return (lNode.userAccessLevel & actionFlag) === actionFlag;
}
const userRole = this.getCurrentUserRole();
if (userRole === "default") {
return (lNode.userAccessLevel & actionFlag) === actionFlag;
}
function convertAccessLevel(accessLevel?: string | null): AccessLevelFlag {
const accessLevelN: number = parseInt(accessLevel || "1", 10); // CurrentRead if not specified
return makeAccessLevelFlag(accessLevelN);
}
function adjust_userAccessLevel(userAccessLevel: any, accessLevel: any) {
userAccessLevel = utils.isNullOrUndefined(userAccessLevel) ? "CurrentRead | CurrentWrite" : userAccessLevel;
userAccessLevel = makeAccessLevelFlag(userAccessLevel);
accessLevel = utils.isNullOrUndefined(accessLevel) ? "CurrentRead | CurrentWrite" : accessLevel;
accessLevel = makeAccessLevelFlag(accessLevel);
return makeAccessLevelFlag(accessLevel & userAccessLevel);
}
function adjust_userAccessLevel(userAccessLevel: any, accessLevel: any) {
userAccessLevel = utils.isNullOrUndefined(userAccessLevel) ? "CurrentRead | CurrentWrite" : userAccessLevel;
userAccessLevel = makeAccessLevelFlag(userAccessLevel);
accessLevel = utils.isNullOrUndefined(accessLevel) ? "CurrentRead | CurrentWrite" : accessLevel;
accessLevel = makeAccessLevelFlag(accessLevel);
return makeAccessLevelFlag(accessLevel & userAccessLevel);
}
function adjust_userAccessLevel(userAccessLevel: any, accessLevel: any) {
userAccessLevel = utils.isNullOrUndefined(userAccessLevel) ? "CurrentRead | CurrentWrite" : userAccessLevel;
userAccessLevel = makeAccessLevelFlag(userAccessLevel);
accessLevel = utils.isNullOrUndefined(accessLevel) ? "CurrentRead | CurrentWrite" : accessLevel;
accessLevel = makeAccessLevelFlag(accessLevel);
return makeAccessLevelFlag(accessLevel & userAccessLevel);
}