Difference between revisions of "NXSL:FindNodeObject"

From NetXMS Wiki
Jump to navigation Jump to search
Line 12: Line 12:
:{|
:{|
|-
|-
| ''node'' || [[NXSL:Node|Node]] object, you can use predefined variable $node to refer to current node. You can also use null as node if trusted nodes check is disabled (see notes for more information).
| ''node'' || [[NXSL:Node|Node]] object, you can use predefined variable $node to refer to current node. You can also use null as node if trusted nodes check is disabled (see [[SG:Security Issues|Security Issues]] for more information).
|-
|-
| ''id'' || ID or name of the node to find.
| ''id'' || ID or name of the node to find.

Revision as of 16:31, 10 April 2012

Find node object by node id or node name.


Syntax

FindNodeObject(node, id);


Parameters

node Node object, you can use predefined variable $node to refer to current node. You can also use null as node if trusted nodes check is disabled (see Security Issues for more information).
id ID or name of the node to find.


Return Value

Node object with given id or name on success or null on failure (either because node with given name/id does not exist, or access to it was denied).


Remarks

Function's behavior depends on server's configuration parameter CheckTrustedNodes. By default access from script running for one node to another nodes are not allowed for security reasons (because if, for example, there are a user with write access to node A and no access to node B, it can create transformation script which will access node B and get information about it, thus breaking security settings). This security check can be disabled by setting server's configuration variable CheckTrustedNodes to 0. Otherwise, system administrator have to maintain trusted nodes lists for each node being accessed from another node's scripts. For example, if $node in script refers to NODE1, and FindNodeObject($node, "NODE2") called, NODE1 must be added to list of trusted nodes for NODE2.


Examples

FindNodeObject($node, "server.netxms.org")	-> object
FindNodeObject(null, 12)			-> object
FindNodeObject($node, "bad_node_name")		-> NULL