Skip to Content
author's profile photo Former Member
Former Member

getUserAccounts() of com.sap.security.api IUser

Hello All,

Referring to UME Javadocs : https://media.sdn.sap.com/javadocs/NW04/SP9/ume/index.html

Method of : com.sap.security.api Interface IUser

getUserAccounts() 
Returns an array of useraccounts objects which are assigned to the user.

Now what is the meaning of <b>array of useraccounts</b>, b'coz IUser corresponds to single unique user.

Now how a user having a unique id can have multiple user accounts.

Please explain in details.

regards

Santosh

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Oct 21, 2005 at 11:23 AM

    Hi,

    This method return you an array of the IUser object. We can use the enumeration techniques to get the IUser data for every user.

    Thanks.

    Regards,

    Peter

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 21, 2005 at 11:30 AM

    Hi Santosh,

    queted from:

    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/91f0cd90-0201-0010-a190-c4d7cbd5b463

    In EP5 you could simply call getUid() to obtain the logon ID. However, you will notice that this method is deprecated in EP6. This is primarily due to the fact that a user can be associated with multiple logon accounts. The Javadocs say to use getUniqueId() as a replacement for getUid(), but this returns a value that must be parsed to get the logon ID. You can access the actual logon ID by iterating through the IUserAccounts array obtained by calling getUserAccounts(). The logon ID is retrieved using the new call getLogonUid(). Often times you can simply pick the first element in the array:

    String logonID = user.getUid();
    IUserAccount accounts[] = null;
    try {
        accounts = user.getUserAccounts();
    } catch (UMException e) {
        response.write(("<br>Error getting accounts: " + e.getLocalizedMessage());
    }
    if (accounts != null) {
        response.write("<br>Number of Login Accounts: " + accounts.length);    
    
        for (int i = 0; i < accounts.length; i++) {
            response.write(
                "<br>** Login ID #"    + i
                    + ": LogonUID="    + accounts[ i ].getLogonUid()
                    + ", AssignedUID=" + accounts[ i ].getAssignedUserID());
            response.write(
                "<br>Last Login: "
                    + accounts[ i ].getLastSuccessfulLogonDate().toString());
            response.write(
                "<br># Logins: " + accounts[ i ].getSuccessfulLogonCounts());
        }
    }

    Hope That helps,

    Yoav.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Yoav,

      I believe that in EP userID = LoginID.

      So in your above give code, stmt as:

      String logonID = user.getUid()/UniqueID();

      would definitely return uniqueID of only one user.

      So if this is true, how can I retrieve multiple user accounts of a particular EP user?

      <u>In other words</u>,

      When I create EP user from User Administration in EP, the first field I need to put in is the UserID which is taken to be the LoginID.

      When I retrieve the Unique ID of this newly created EP user, the returned loginid string is concatinated with the userid (<i>which is loginid</i>) of the user.

      If true, then we need to think of someother key by which we can differenciate an EP user.

      Please guide.

      Awaiting Reply.

      Thanks and Warm Regards,

      Ritu R Hunjan

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.