Skip to Content
0

Get portal user in SAPUI5

Mar 30, 2017 at 06:30 PM

120

avatar image

I have to create a SAPUI5 application in portal. When user clicks that iview, I need to get the portal user logged. How we can get the portal user in SAPUI5 application?

sap | ui5
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

A K Mar 31, 2017 at 04:30 AM
0
Share
10 |10000 characters needed characters left characters exceeded
Arthur Silva Apr 14, 2017 at 03:46 PM
0

Hello,

I faced the same issue a couple of days ago. I presume that you're using NWDS to develop, and using a SAPUI5 web based project. To get the logged user from SAP Portal in your SAPUI5 project, you should use class com.sap.security.api.UMFactory, which is a interface of user settings. It is also possible to get specific details by using this class, just like name, address, roles, and so on.

I suppose your using servlet to update your model. For the first servlet call (or for each model update), try the below code:

IUser user= UMFactory.getAuthenticator().getLoggedInUser(request, response);
if(null==user){
// forces username
UMFactory.getAuthenticator().forceLoggedInUser(request, response);
}
String userName =request.getRemoteUser();

Documentation might be found here
https://help.sap.com/doc/saphelp_dimp50/5.0/de-DE/80/45da9619d24b61bb869c31ef3b780a/frameset.htm

Regards,
Arthur Silva

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hello Arthur,

I have to put this code in my controller?

0