node-opcua-address-space 2.179.0 → 2.180.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-address-space",
3
- "version": "2.179.0",
3
+ "version": "2.180.0",
4
4
  "description": "pure nodejs OPCUA SDK - module address-space",
5
5
  "main": "./dist/src/index_current.js",
6
6
  "types": "./dist/source/index.d.ts",
@@ -21,35 +21,35 @@
21
21
  "@types/semver": "7.8.0",
22
22
  "chalk": "4.1.2",
23
23
  "dequeue": "^1.0.5",
24
- "node-opcua-address-space-base": "2.179.0",
24
+ "node-opcua-address-space-base": "2.180.0",
25
25
  "node-opcua-assert": "2.179.0",
26
- "node-opcua-basic-types": "2.179.0",
27
- "node-opcua-binary-stream": "2.179.0",
28
- "node-opcua-client-dynamic-extension-object": "2.179.0",
26
+ "node-opcua-basic-types": "2.180.0",
27
+ "node-opcua-binary-stream": "2.180.0",
28
+ "node-opcua-client-dynamic-extension-object": "2.180.0",
29
29
  "node-opcua-constants": "2.179.0",
30
30
  "node-opcua-crypto": "5.9.0",
31
- "node-opcua-data-access": "2.179.0",
32
- "node-opcua-data-model": "2.179.0",
33
- "node-opcua-data-value": "2.179.0",
34
- "node-opcua-date-time": "2.179.0",
31
+ "node-opcua-data-access": "2.180.0",
32
+ "node-opcua-data-model": "2.180.0",
33
+ "node-opcua-data-value": "2.180.0",
34
+ "node-opcua-date-time": "2.180.0",
35
35
  "node-opcua-debug": "2.179.0",
36
36
  "node-opcua-enum": "2.179.0",
37
- "node-opcua-extension-object": "2.179.0",
38
- "node-opcua-factory": "2.179.0",
37
+ "node-opcua-extension-object": "2.180.0",
38
+ "node-opcua-factory": "2.180.0",
39
39
  "node-opcua-nodeid": "2.179.0",
40
- "node-opcua-nodeset-ua": "2.179.0",
41
- "node-opcua-numeric-range": "2.179.0",
40
+ "node-opcua-nodeset-ua": "2.180.0",
41
+ "node-opcua-numeric-range": "2.180.0",
42
42
  "node-opcua-object-registry": "2.179.0",
43
- "node-opcua-pseudo-session": "2.179.0",
44
- "node-opcua-service-browse": "2.179.0",
45
- "node-opcua-service-call": "2.179.0",
46
- "node-opcua-service-history": "2.179.0",
47
- "node-opcua-service-translate-browse-path": "2.179.0",
48
- "node-opcua-service-write": "2.179.0",
49
- "node-opcua-status-code": "2.179.0",
50
- "node-opcua-types": "2.179.0",
43
+ "node-opcua-pseudo-session": "2.180.0",
44
+ "node-opcua-service-browse": "2.180.0",
45
+ "node-opcua-service-call": "2.180.0",
46
+ "node-opcua-service-history": "2.180.0",
47
+ "node-opcua-service-translate-browse-path": "2.180.0",
48
+ "node-opcua-service-write": "2.180.0",
49
+ "node-opcua-status-code": "2.180.0",
50
+ "node-opcua-types": "2.180.0",
51
51
  "node-opcua-utils": "2.179.0",
52
- "node-opcua-variant": "2.179.0",
52
+ "node-opcua-variant": "2.180.0",
53
53
  "node-opcua-xml2json": "2.179.0",
54
54
  "semver": "^7.8.5",
55
55
  "thenify-ex": "4.4.0",
@@ -60,9 +60,9 @@
60
60
  "node-opcua-benchmarker": "2.179.0",
61
61
  "node-opcua-leak-detector": "2.179.0",
62
62
  "node-opcua-nodesets": "2.179.0",
63
- "node-opcua-packet-analyzer": "2.179.0",
64
- "node-opcua-schemas": "2.179.0",
65
- "node-opcua-service-filter": "2.179.0",
63
+ "node-opcua-packet-analyzer": "2.180.0",
64
+ "node-opcua-schemas": "2.180.0",
65
+ "node-opcua-service-filter": "2.180.0",
66
66
  "node-opcua-test-fixtures": "2.179.0"
67
67
  },
68
68
  "author": "Etienne Rossignon",
@@ -80,7 +80,7 @@
80
80
  "internet of things"
81
81
  ],
82
82
  "homepage": "http://node-opcua.github.io/",
83
- "gitHead": "c78c6ee424bae3c6e851fabd8e144390e2941f8a",
83
+ "gitHead": "11ad1e0894355cd279e19443c6c9a4fc090e7d7a",
84
84
  "files": [
85
85
  "dist",
86
86
  "distHelpers",
@@ -245,28 +245,36 @@ function getDefaultUserRolePermissionsOnNamespace(
245
245
  }
246
246
 
247
247
  const namespaces = namespace.addressSpace.rootFolder?.objects?.server?.namespaces;
248
- if (!namespaces) {
249
- return null;
250
- }
251
- const uaNamespaceObject = namespaces.getChildByName(namespace.namespaceUri);
252
- if (!uaNamespaceObject) {
253
- return null;
254
- }
255
- const defaultUserRolePermissions = uaNamespaceObject.getChildByName("DefaultUserRolePermissions") as UAVariable;
256
- if (defaultUserRolePermissions) {
257
- const dataValue = defaultUserRolePermissions.readValue();
258
- if (dataValue?.statusCode.isGood() && dataValue.value.value && dataValue.value.value.length > 0) {
259
- return dataValue.value.value as RolePermissionType[];
248
+ const uaNamespaceObject = namespaces?.getChildByName(namespace.namespaceUri);
249
+ if (uaNamespaceObject) {
250
+ // DefaultUserRolePermissions is the user-specific policy and wins when it carries a value.
251
+ const defaultUserRolePermissions = uaNamespaceObject.getChildByName("DefaultUserRolePermissions") as UAVariable;
252
+ if (defaultUserRolePermissions) {
253
+ const dataValue = defaultUserRolePermissions.readValue();
254
+ if (dataValue?.statusCode.isGood() && dataValue.value.value && dataValue.value.value.length > 0) {
255
+ return dataValue.value.value as RolePermissionType[];
256
+ }
260
257
  }
261
- }
262
- const defaultRolePermissions = uaNamespaceObject.getChildByName("DefaultRolePermissions") as UAVariable;
263
- if (defaultRolePermissions) {
264
- const dataValue = defaultRolePermissions.readValue();
265
- if (dataValue?.statusCode.isGood()) {
266
- return dataValue.value.value as RolePermissionType[] | null;
258
+ const defaultRolePermissions = uaNamespaceObject.getChildByName("DefaultRolePermissions") as UAVariable;
259
+ if (defaultRolePermissions) {
260
+ const dataValue = defaultRolePermissions.readValue();
261
+ const value = dataValue?.value?.value as RolePermissionType[] | null | undefined;
262
+ // Honour a real value only. The metadata node is left Null-typed (value === null)
263
+ // unless setNamespaceMetaData() bound it, so a null must fall through to the
264
+ // namespace policy below instead of short-circuiting the whole lookup to null.
265
+ if (dataValue?.statusCode.isGood() && value !== null && value !== undefined) {
266
+ return value;
267
+ }
267
268
  }
268
269
  }
269
- return null;
270
+
271
+ // Fall back to the policy configured programmatically via Namespace.setDefaultRolePermissions().
272
+ // The NamespaceMetadata node is only bound to that field when setNamespaceMetaData() is called
273
+ // (which throws on NodeSet2-loaded namespaces), and is absent entirely for a programmatically
274
+ // created namespace. Consulting the field here keeps the configured default consistent between
275
+ // the local getter (BaseNode.getRolePermissions(inherited=true)) and this enforcement path,
276
+ // so setDefaultRolePermissions() takes effect without also requiring setNamespaceMetaData().
277
+ return namespace.getDefaultRolePermissions();
270
278
  }
271
279
 
272
280
  /**