Contains the username for the current process.
contains the username for the current process. This can be in one of two forms:
The name of the current user; for example: Mary
. This value is returned if multiple security domains are not allowed.
The name and system address of the current user; for example: Mary@jupiter
. This value is returned if multiple security domains are allowed.
To allow multiple security domains, go to the Management Portal
, select [Home] > [Security Management] > [System Security Settings] > [System-wide Security Parameters]
. Select the Allow multiple security domains
check box. Changes to this setting apply to new invoked processes; changing it does not affect the value returned by the current process.
You cannot use the SET
command or the NEW
command to modify this value. However, NEW $ROLES
also stacks the current $USERNAME
Commonly, the $USERNAME
value is the username specified at connection time. However, if unauthenticated access is permitted, a user terminal or an ODBC client may connect to Caché without specifying a username. In this case, $USERNAME
contains the string UnknownUser.
When a process is created using the JOB command, it inherits the same $USERNAME
values as its parent process.
A username can be created using the SQL CREATE USER
statement and deleted using the SQL DROP USER
statement. A user password can be changed using the SQL ALTER USER
statement. A user can have roles assigned to it, either by using the SQL GRANT
statement, or by using system utilities to add a role to the user. You can access the list of roles assigned to the current process with the $ROLES
special variable. A role can be revoked from a user using the SQL REVOKE
is used in Caché SQL as the USER, CURRENT_USER, and SESSION_USER default field values.
You can return the username for the current process, or for a specified process, by invoking the $SYSTEM.Process.UserName()
The following example returns the username for the current process.
The following example returns the domain name for the current process.