node-opcua-address-space 2.187.11 → 2.187.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -942,7 +942,7 @@ export class AddressSpaceImpl implements AddressSpacePrivate {
942
942
  *
943
943
  *
944
944
  */
945
- public browsePath(browsePath: BrowsePath): BrowsePathResult {
945
+ public browsePath(browsePath: BrowsePath, context?: ISessionContext): BrowsePathResult {
946
946
  assert(browsePath instanceof BrowsePath);
947
947
 
948
948
  const startingNode = this.findNode(browsePath.startingNode);
@@ -989,10 +989,21 @@ export class AddressSpaceImpl implements AddressSpacePrivate {
989
989
 
990
990
  const res: BrowsePathTargetOptions[] = [];
991
991
 
992
+ // a node the context cannot browse is invisible: neither followed nor returned
993
+ const isBrowseDenied = (nodeId: NodeId): boolean => {
994
+ if (!context) {
995
+ return false;
996
+ }
997
+ const node = this.findNode(nodeId);
998
+ return !!node && context.isBrowseAccessRestricted(node);
999
+ };
1000
+
992
1001
  const explore_element = (curNodeObject: BaseNode, elements: RelativePathElement[], index: number) => {
993
1002
  const element = elements[index];
994
1003
  const is_last = index + 1 === elements.length;
995
- const nodeIds = curNodeObject.browseNodeByTargetName(element, is_last);
1004
+ const nodeIds = curNodeObject
1005
+ .browseNodeByTargetName(element, is_last)
1006
+ .filter((nodeId: NodeId) => !isBrowseDenied(nodeId));
996
1007
  const targets = nodeIds.map((nodeId: NodeId) => {
997
1008
  return {
998
1009
  remainingPathIndex: elements.length - index,
@@ -811,7 +811,7 @@ function _clone_collection_new(
811
811
 
812
812
  // also clone or instantiate interface members that may be required in the optionals
813
813
  extraInfo.level++;
814
- _cloneInterface(nodeToClone, clonedNode, node, optionalFilter, extraInfo, browseNameMap);
814
+ _cloneInterface(nodeToClone, clonedNode, node, copyAlsoModellingRules, optionalFilter, extraInfo, browseNameMap);
815
815
  extraInfo.level--;
816
816
  // === clone);
817
817
  // extraInfo.registerClonedObject(clone, node);
@@ -900,6 +900,7 @@ function _cloneInterface(
900
900
  nodeToClone: UAObject | UAVariable | UAMethod | UAObjectType | UAVariableType,
901
901
  clonedNode: BaseNode,
902
902
  node: UAObject | UAVariable | UAMethod,
903
+ copyAlsoModellingRules: boolean,
903
904
  optionalFilter: CloneFilter,
904
905
  extraInfo: CloneExtraInfo,
905
906
  browseNameMap: Set<string>
@@ -949,7 +950,7 @@ function _cloneInterface(
949
950
  `\n${extraInfo?.pad()}`,
950
951
  aggregates.map((r) => r.toString({ addressSpace })).join(`\n${extraInfo?.pad()}`)
951
952
  );
952
- _clone_collection_new(nodeToClone, clonedNode, aggregates, false, localFilter, extraInfo, browseNameMap);
953
+ _clone_collection_new(nodeToClone, clonedNode, aggregates, copyAlsoModellingRules, localFilter, extraInfo, browseNameMap);
953
954
  }
954
955
  }
955
956