cancel
Showing results for 
Search instead for 
Did you mean: 

How to assign portal user to webdynpro app

bernd_speckmann
Contributor
0 Kudos

Hi,

I developed a webdynpro app without setting any permission parameters. When I run it direct from my studio first an logon screen appears. When I logged on and write some data into the database the user there is identical with the user I entered in the logon screen.

When I integrate the app into the "portal" (it's an ce7.11), the user in the database fields is always guest and not the user logged on to the portal.

How can I change this? I want the user who is logged on to the portal as the user written to the database.

Thanks ahead.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Set the webdynpro application parameter authentication to true and try.when writing data in to table are you retreiving the logged user from portal and sending to backend or how you are doing this?can you post the code used to send the data to database.

Thanks,

pkv

bernd_speckmann
Contributor
0 Kudos

Hello,

yes, I set the application parameter authetication to true. The data is written to the database via a webservice pointing to a CAF application. And the CAF app is writing the data into the database.

Hope this helps...

susmita_panigrahi
Active Participant
0 Kudos

Hi

There is another way also in webdydnpro.1st store the portal user name in a variable and send that variable value to data base.Write the below code in WdDoInit() method:

try{

// get the currently logged in user

IWDClientUser wdUser = WDClientUser.getCurrentUser();

// get the com.sap.security.api.Iuser; It is null in case wdUser represents an anonymous user

IUser user = wdUser.getSAPUser();

// check whether the user is anonymous

if (user != null)

{

// access logon ID by iterating through the IUserAccount array

IUserAccount[] acct = user.getUserAccounts();

if(acct[0] != null)

{

String strUserid = acct[0].getLogonUid();

// strUserid now contains the User name.Pass the value obtained from the portal to backend

}

}

}

catch(Exception e)

{

wdComponentAPI.getMessageManager().reportException("Unable to get the Details. Please check the server logs. " ,true);

e.printStackTrace();

}

Thanks

Susmita

bernd_speckmann
Contributor
0 Kudos

The crux seems to be the caf application. There are no (not yet) permission checks enabled. When I run the webdynpro application which uses the caf through a webservice, no access to the database is possible.

But when I first run "test service" (and log on in the appearing logon screen) out from my developer studio the webdynpro application in the same browser instance is able to access the data.

So it seems, that the portal logon is not the same logon as when I run "test service" out of the developer studio.

So I have to pass the portal logon to the CAF logon. Is this right and how is this possible?

Thanks ahead.

bernd_speckmann
Contributor
0 Kudos

The solution was to enable the permission checks for the caf application service. In addition I set the security of the service endpoint to logon ticket.

Regards