You can use currentusername to obtain the Windows username of the currently logged-in machine user in legacy, client-side WPF expressions.
Purpose
currentusername is a legacy OCL operator that returns the username for the user currently logged in to Windows.
Use it only when you specifically need the Windows machine identity in a WPF client. It does not identify the user of your application.
Do not use it for the application user
On a server, the logged-in Windows user can be a server account rather than the person using the application. Therefore, do not use currentusername for application authorization, user-specific data, or other application-user logic.
Use the application user exposed through the system singleton instead:
SysSingleton.oclSingleton.CurrentUser
For example, when an expression needs to work with the user who is signed in to the application, base that expression on SysSingleton.oclSingleton.CurrentUser, not on the Windows username.
Client and server behavior
| Context | Meaning of currentusername
|
Recommended use |
|---|---|---|
| WPF client | The Windows username of the person currently logged in to that machine. | Use only for legacy client-side scenarios that require the Windows identity. |
| Server | A server-side Windows account may be returned. | Use SysSingleton.oclSingleton.CurrentUser when you need the application user.
|
Related Windows identity information
If you also need the Windows domain name, use currentuserdomainname. Apply the same limitation: it is legacy, Windows-specific information and is not the application user's identity.
