How to get user?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How to get user?
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.
- Labels:
-
Other
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
What shows the output if you call the method
RemoteMethodServer.getUserName()
and you aren't calling something like
SessionHelper.manager.setAdministrator();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
RemoteMethodServer.getDefault().getUserName(); returns null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
otherwise you have to try somehting like
WTPrincipal localPrincipal = SessionHelper.manager.getPrincipal();
SessionHelper.manager.setPrincipal(localPrincipal.getName());
