Getting The User ID From Connections Addendum1

As a little add on from This post on getting The User Id from IBM Connections, we discovered another little wrinkle, and that is the single sign on name that you get from @username in domino is not necessary the same as the what IBM connections is wanting in the ?Name= search parameter in its profile search, as we all should know the domino full name is not always the FirstName + ” ” + Last name then we tend to expect, so I just do a little lookup before running the function in the previous blog post

That is

String userid = convertSSOnametoFullName( userNab, agentContext.getEffectiveUserName().toString());
userid = getUserID( adminUserName, adminPassword, baseURL, ProfileNameSearch, userid);

The top function is below, the second function is [here](

private String convertSSOnametoFullName(  String NabNsf, String SSOUser) throws NotesException {
    System.out.println("convertSSOnametoFullName 0.1 " + SSOUser + NabNsf);
        String FullName = "";
        Session session = getSession();
        Database db = session.getDatabase(null, NabNsf);
        View view = db.getView("($VIMPeople)");
        DocumentCollection dc = view.getAllDocumentsByKey(SSOUser, true);
        //if we get more that 1 result then its a bad name to search and for security reasons we will return nothing
        if( dc.getCount() == 1) {
            Document nabdocument = dc.getFirstDocument();
            FullName = nabdocument.getItemValueString("FirstName") + " " + nabdocument.getItemValueString("LastName"); 
        } else if (dc.getCount() == 0){
            //we cant find that person in this address book so I going to return the name they put in as opposed to a blank, in case its a valid name in another address book
            FullName = SSOUser;
        System.out.println("end convertSSOnametoFullName 0.1 " + FullName + " " + dc.getCount());
    return FullName; 

Leave a Reply

Your email address will not be published.