How do you retrieve the user ID of a logged-in user from the LDAP instead of the user name which may not be unique?
There are two ways to achieve this :
1. Setting the "api.use.dn" parameter in WCMConfigService.properties to True gives you the distinguished name (DN) of the user instead of the display name when calling the getUserName() method.
2. You can dynamically set this by calling
"workspace.useDistinguishedNames(true)" before calling "workspace.getUserProfile()".
Essentially this would be similar to the following:
Workspace workspace = p_contextProcessorParams.getWorkspace();
workspace.useDistinguishedNames(true);
String currentCust = CustContextProcessorUtils.getCustomer(workspace.getUserProfile().getUsername());