on 01-25-2005 4:27 PM
Hi,
I created a Webdynpro application and also created an iView which is integrated in Portal. This application has one parameter, user name. I'm trying to get the logon user name from the Portal and send it to my Webdynpro applicaiton iView.
In the iView definition, I can put parameter value statically in Application Parameters. How can I dynamically get the log on user name?
Thanks
Hello Wei,
The current user can than be retrieved with
WDClientUser.getCurrentUser()
and you get an IUser object with
WDClientUser.getCurrentUser().getSAPUser()
Regards
Abdul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Abdul,
Thanks a lot for your help. I think this is what I need.
But maybe the user setting in my system is not correct and I'm not familiar with the user management in Portal and Webdynpro, when I call getCurrentUser(), it didn't return the correct data.
My Portal is running on one server and my Webdynpro application is running on a different J2EE server. I logged onto Portal using a user name and password, and my webdynpro app doesn't need log on. When I call WDClientUser.getCurrentUser() in my webdynpro app, what user does it return back? I'm trying to get the Port user name.
Thanks for advice.
Wei
Hello Wei,
The IUser object is the portal user. You can call the following to get more info
This interface provides read-access to the user's attributes, and offers basic support for authorization checking.
getFirstName()
Gets the user's first name.
getCellPhone()
Gets the user's default cellphone number.
hasPermission(permission)
Returns true if the user has the given permission.
Regards
Abdul
Hi Abdul & everyone,
I cannot find any method called WDClientUser.getCurrentUser().getSAPUser(). Do i need to add some jar file or something? Please do advice.
When i try to print and see:: WDClientUser.getCurrentUser().getClientUserID(), it gives me some unique 2 digit number. The 2 digit number is unique for each logged in user.
For ex: In one login it returns "37" and for another user, it gives "41" etc...
Awaiting your reply.
<b>Regards,
Sai krishna.</b>
Hi All,
I've imported the security jar, but I'm getting the IUser as 'anonymous'. What does this mean?
My WAS and EP are running on different J2EE instances.
When I check the 'Authentication' checkbox while creating WD application and test the WD on WAS it correctly gives me the current user. In my case it is 'Administrator', which is the WAS user for testing WD.
But when I remove this check, and deploy this application onto EP, in EP I get the IUser object as 'null'. Ideally I should get the current EP user ID to be displyed in the iView.
Am I missing something?
Thanks in advance.
Regards,
-Vaibhav.
Hi there,
I have quiet the same problem. When I have no authentication configured in my WebDynpro application I get null for the IUser... (Portal and J2EE engine on same machine).
When I configure my WD application to turn authentication on, I get a NEW LOGIN screen with user data from portal not working.
I want ONE login in the portal and just get the User ID of the logged in user to show him HIS data in the application. Sounds not very complicated and - in my point of view - is a standard scenario of every a little bit more sophisticated application then the SAP examples. It is very disapointing to see nothing like that in the example application and in the documentation, which is in fact for what I'm used to get in the J2EE world, very poor.
What do I have to do, to get such an easy thing just working????
Thanx,
Frank
Hi, the jar file should be in
your netweaver was installation directory
You know the location of the com.sap.security.api.jar.
You can find this file on the J2EE Engine in the \bin\ext\com.sap.security.api.sda directory for the server.
C:\usr\sap\<SID>\JC00\j2ee\cluster\server0\bin\ext\
com.sap.security.api.sda\com.sap.security.api.sda.jar
Hi All,
Thank you for your support.
I've added the security jar in my classpath.
Still If i tried IUSer is returning NullPointerException.
What should I do to get the portal user?
Here is my code..
try {
IUser user = WDClientUser.getCurrentUser().getSAPUser();
messageManager.reportSuccess("Before calling ");
messageManager.reportSuccess("Client User ID " +WDClientUser.getClientUser("6"));
messageManager.reportSuccess("After calling ");
try{
firstName = user.getFirstName().toString();
}catch (NullPointerException nle){
messageManager.reportSuccess("inside catch block ");
nle.printStackTrace();
return;
}
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.