cancel
Showing results for 
Search instead for 
Did you mean: 

How to get IUserContext from IUser ?

former_member188556
Active Contributor
0 Kudos
87

Hello All,

I am trying to get the IUserContext object from IUser object.

I found a very easy method

com.sapportals.portal.prt.session.IUserContext userContext= request.getUser();

which will give IUserContext object.

What I am trying to do is to get the same from an userid.

Regards

Bobu

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

As per my knowledge; UserContext stores the user session related information. Hence UserContext cannot exist without associated session.

Hence UserConext cannot be fetched using IUser API. Please check API - http://help.sap.com/javadocs/NW04S/SPS09/se/index.html

Regards,

Ganga

former_member188556
Active Contributor
0 Kudos

So Ganga,

I am trying to do as per this [Site Map|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/2302] [original link is broken];. Here, the modification I would require is, to get the same site map, for another user. This is for an administration purpose. So that an administrator can enter a user id and get the roles and worksets associated to the specific users

Regards

Bobu

Former Member
0 Kudos

Hi,

For your requirement of Admin to check the sitemap of other users, the approach could be

a) Create a JSP which takes user id and password- Cerate java bean with getter, setter methods to store these values

b) In method getEnvironment(), change the code to handle Admin collected user information instead of contex based user info.

regards,

Ganga

Former Member
0 Kudos

Hi Bobu,

I am not entirely sure but I think you can just put an IUser object into the environment.

So instead of using the IUserContext taken from the request, retrieve the IUser object that you need ( e.g. IUserFactory.getUserByLogonId("someUser")) and put it into the environment. I think the navigation service will then return the navigation for "someUser".

Good luck,

Tanja

Former Member
0 Kudos

Hi All

I have used an IUser object as Tanja suggests and it works for me.

Cheers

Torben

Former Member
0 Kudos