As a 4D developer you often need to manage end users with your own directory system. For internal users, you might create a few profiles with different rights or you might just use the default Designer account for everyone. The problem is when multiple people use the same profile, everyone has the same name and it’s difficult – sometime impossible – to differentiate them. Fortunately, 4D v17 R5 resolves the headache of trying to figure out who’s who. In this blog post, we’ll explain a new command and new selectors that’ll help you set the 4D user identity by defining a custom name to use instead of the current 4D user account name.
HDI: new way to identify users
a NEW COMMAND to the rescue
The SET USER ALIAS command accepts a string as unique parameter to create an alias which will replace the 4D user name in the entire 4D environment … even in the case of twin processes on the server.
// Set my own user field as alias
SET USER ALIAS ([MyUserTable]Name)
4D maintains the user alias for the duration of the session on both the remote and the server applications. The command doesn’t change the original 4D user name in the 4D directory, it simply sets an alias on this user name. While available for single use applications, it’s mainly designed for client/server configurations.
To cancel a user alias, just call SET USER ALIAS (“”).
The screenshots below show the 4D Server Administration Windows with and without aliases:
NEW SELECTORS
The Current user command has been updated to accept an optional selector : 4D user alias or account, 4D user alias, or 4D user account.
4D user alias or account is the default selector. If you’ve used SET USER ALIAS during the session, the Current user command returns the alias you set. If you haven’t made used SET USER ALIAS, it will return the original user account name.
// Trigger on myTable to store the last user updating the record (alias if it's set, 4D user account otherwise)
[myTable]lastUpdater:=Current user
Check out the doc center for more details and see the new command in action with the HDI above.