CurrentUser Property (Server object)

                 

 

A read-only string property returning the name of the current or last logged on PIUser or the list of PIIdentities for the current authenticated principal.

Syntax

object.CurrentUser

The object placeholder is an object expression that evaluates to a Server object.

Remarks

The returned value is a string. If no connection has yet been made to the Server by the process, there is no Current User and the error pseNOCURRENTUSER is raised if the property is accessed. This property is not cleared when a connection is closed allowing an application to access the last logged on user name within the process. When a new connection is opened to the user, the CurrentUser property is updated.  If a trust relationship is used for connecting to the server, this property will reflect the name of the PIUser granted the trust connection.  See Server.Open for details.

With the introduction of PI Server 3.4.380, security principals in PI are expanded to include PIIdentities as well as PIUsers and PIGroups.  When connecting to these newer servers, the CurrentUser property will return either a PIUser or a string containing one or more PIIdentitiesPIIdentities, defined on the PI server, are mapped to Windows principals by an administrator.  Authenticated Windows users will automatically pick up these mapped identities when connecting to PI using the "Windows Security" authentication protocol.  Older implicit authentication protocols, PI Trust and Default User are still supported and the order and use of these protocols can now be configured.  Explicit authentication (username/password) are also still supported.  Because a Windows user may belong to several Windows (Active Directory) groups each of which could be mapped to a PIIdentity, it is not uncommon for a user connected to PI through Windows Authentication to be represented by multiple PIIdentities.  The CurrentUser property will show these identities as a single string delimited by the pipe ( | ) character.  For example:

piadmin | piadmins | pidemo | piusers | PIWorld

In all cases, the contents of the CurrentUser property are the PI principals that are used to evaluate the user's privileges when accessing objects in the PI server. Two connected windows users with the same CurrentUser string will have the same access rights to server objects.

Trappable Errors

Error Description
pseNOCURRENTUSER There is no value for the current user. Typically this means a connection has not yet been made to this server.

Enabling Operational Intelligence