Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Hi.
How can i get current WTUser by java code?
I tried
WTPrincipal currentUser = SessionHelper.manager.getPrincipal();
and
MethodContext methodcontext = MethodContext.getContext();
methodcontext.mbean.getUserName();
Both of them don't work. They return "wcadmin" always.
Thanks.
Solved! Go to Solution.
When you launch a jsp page, you can use the following
<%
String username = wt.session.SessionHelper.getPrincipal().getName();
%>
Where is your code started from? Could it be that the code is running with administrator access?
When you launch a jsp page, you can use the following
<%
String username = wt.session.SessionHelper.getPrincipal().getName();
%>
Where is your code started from? Could it be that the code is running with administrator access?
Hi, Björn.
I tried your code and it gave me correct result.
I'm loading applet from jsp.
Then i create wtpart from applet via wt.method.RemoteAccess.
The creator of my wtpart is defined as Administrator. How can i set the real creator?
Thanks.
What shows the output if you call the method
RemoteMethodServer.getUserName()
and you aren't calling something like
SessionHelper.manager.setAdministrator();
RemoteMethodServer.getDefault().getUserName(); returns null
otherwise you have to try somehting like
WTPrincipal localPrincipal = SessionHelper.manager.getPrincipal();
SessionHelper.manager.setPrincipal(localPrincipal.getName());