Search the FirstSpirit Knowledge Base
I tried this: #global.project.getUserService().getUser().getLoginName() but this returns "SYSTEM".
Why? What I would like to have is the current user.
I want to retrieve currently logged in user name
Hi,
I had the same requirement Aktueller FS-User über globale Systemvariable global im Contentcreator
kind regards
Marcel
but i need code for same
Write a executable where you get the current user.
The ClientScriptContext has a method "getUser".
but unfortunately my complete code is written in HTML o/p channel.
Hi,
getting the user during generation time is not possible as the generation is not user/session specific. For example, the generated files are cached in the preview for a while, so it is not even guaranteed that a preview generation is performed at all when a user calls a preview page.
Could you describe your use case in more detail?
Michael
Hi Michael
We require only login user name in content creator. currently we're getting only "SYSTEM" with following API.
#global.project.getUserService().getUser().getLoginName()
#global.project.getUserService().getUser().getEMail()
#global.project.getUserService().getUser().getName()
#global.project.getUserService().getUser().getLDAPSection()
Regards Tanmay
Hi Tanmay,
could you explain the purpose / scenario why and when you need the user name in CC? Maybe there is another solution than trying to use template syntax (which will not be successful).
Regards
Michael
Hi,
write a executable like that
public final synchronized Object execute(Map<String, Object> params) {
ClientScriptContext context = params.get("context");
Map<String, String> returnMap = params.get("returnMap");
User user = context.getUser();
returnMap.put("userName", user.getLoginName());
}
This executable is callable from a FirstSpirit Script and also with WE_API.
kind regards
Marcel
HI
Could please help me where should I write this & how to call this on HTML o/p channel?