How to get OPC UA variable AccessLevel using node-red-contrib-opcua

Hi everyone,

I'm using node-red-contrib-opcua 0.2.355 as a client to read/write variables and I want to get the "AccessLevel" (read, write or read/write) of a variable node.

This information is not provided when I do a simple "browse" or "read" request with my client node.

Is there a way to get this AccessLevel?

Thank you,

Iou

Try the client's INFO action with the variable's NodeId in msg.topic, and connect its first output to a Debug node set to show the complete message. In 0.2.355, INFO calls readAllAttributes and merges the returned attributes into the output message, so look for msg.accessLevel and msg.userAccessLevel rather than only msg.payload. These are bitmasks: 0x01 is CurrentRead and 0x02 is CurrentWrite; userAccessLevel also takes the session user's rights into account. I checked this against the 0.2.355 source, but have not tested it against your server.

Ok thanks Rei, it works.

While I'm at it, is there a way to use "info" on every variable node of the server without using a loop function like when I "browse" ns=4;i=1?

In 0.2.355, INFO reads the attributes of one NodeId from msg.topic; it doesn't recursively browse the server. If you already have an array of variable NodeIds, a core Split node can turn it into individual messages, so you don't need a JavaScript loop function. Each message would still need its NodeId in msg.topic before reaching INFO. That is still a separate INFO operation for each variable, not one server-wide request.