Skip to Content
avatar image
Former Member

Passing the user ID from portal to the backend and update it in the table

Hi Experts

In my portal application i need to pass the username of the person who is logged in and pass the same from the portal code to the backend and update it in the table.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Jan 06, 2011 at 03:38 PM
    IWDClientUser wdclientuser = WDClientUser.getCurrentUser();
                            if (wdclientuser != null) {
    
                                    com.sap.security.api.IUser iUser = wdclientuser.getSAPUser();
                                    if (iUser != null) {
    
                                            IUserAccount[] accounts = iUser.getUserAccounts();
                                            if (accounts[0] != null) {
    
                                                    userID = accounts[0].getLogonUid();
    
                                            }
                                    }
    
                            }
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 07, 2011 at 04:33 AM

    IWDClientUser clientUser = WDClientUser.getCurrentUser();

    IUser User = clientUser.getSAPUser();

    if (User != null)

    {

    try

    {

    IUserAccount[] acct = User.getUserAccounts();

    if(acct[0] != null)

    {

    userID = acct[0].getLogonUid();

    }

    }

    catch(UMException e)

    {

    //Raise some error msg according to your scenario.

    }

    }

    Also try to make this as a common method and call this whenever you required, so that in future projects also you dont want to write the same code again and again.

    Revert for any queries.

    Regards

    Nizamudeen SM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 07, 2011 at 09:25 AM

    Using this piece of code i get the login ID of the user who is currently logged in but i also want it to be updated in the backend table. I have created a value attribute for the same and i am setting the same in the custom controller using its setter method but after this it is throwing an "array out of bound exception -1" although i have added an extra parameter for the execute method in the custom controller. I have also done the model binding for this custom controller value attribute.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 10, 2011 at 03:42 AM

    Thanks to all. My query has been resolved.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Rizwana,

      i have the similar issue to, how your problem got solved send me do u refered any document or pdf.

      it will be useful me in solving the issue

      my issue is

      when ever a portal user logs in, it should validate the user to which region it belongs to and we have external user and internal user by checking in the table, table contains the filelds user, region,client ...

      Thanks in advance

      Thanks&Regards

      charan