AD displayName not showing in Roster

Pandion seems to use the vcard Nickname by default. I think you might be misunderstanding what I think the issue is. When I add a user to my roster I don’t want to have to manually edit the nickname field - I don’t have time to train hundreds of users to do this - I want it to pick up what is defined in the person’s vcard. You suggest

“Spark is not ignoring the nickname it is using the one you provided”

the point is I personally am not providing a nickname when I add the user to my roster. Even though the vcard defines what the nickname should be Spark IS ignoring this and is adding the user to my roster and is displaying the uid. This uid is further written to the jiveRoster.nick field in the OpenFire database. If I define the nickname in the vcard and Spark uses something else in its place then surely that’s a bug? If I can define a nickname field in the vcard then I want Spark to use it!

The only other possibility is that your openfire.xml is still not quite perfect for this to function correctly. I say this because unless i manually type something in my nickname field when manually adding users Spark pulls the info from the LDAP vCard correctly. Looking back at you original post I see one difference in your config from mine. I have this <nameField>cn</nameField> instead of what you have in your config.

I have to agree with butterworth here. When my users manually add someone to their roster Spark pre-populates the Nickname field with the username from the vcard and not the NickName. The option to leave the Nickname blank is not valid as it is populated already and people have to type over it. It is a common complaint with my users even though we’ve documented the behavior. Again we are using Sun LDAP and not AD but I don’t see why that would make a difference.

When I try to add a user from the search function I see their JID, username, name and email.

When I add them to my roster it is using their JID and username, but I would think it would use their Name for the nickname in the roster? Is there a way to set it up so it would do this? I am constantly having to change their nickname from their username to just their first and last name.

Screenshot attached

edit: Sorry just read about leaving it blank for the nickname and when I do that it still puts in the username not the first and last name.

Thanks mtstravel, I will try using cn in the nameField. My users are about to go home for the night so I’ll change the setting and re-start OpenFire. I’ll let you know how I get on tomorrow.

Based on the fact that Spark is pullinig the information correctly for my unless i override it with a custom value I would question the settings of your openfire.xml file. I have attached mine edited for security.

I have tried altering openfire.xml and setting <nameField>cn</nameField>. This didn’t make any difference - when adding a contact the nickname field is still populated with the jid.

With regard to clearing the contents of the nickname field when you add someone to your roster. I have tried this and it works but only to a point. I have encountered errors when trying to add a user to my roster in this way:

  1. Alice adds Bob to her roster. While doing this she clears the Nickname field on the Add Contact form. Bob’s status is shown as Pending on Alice’s roster and Bob’s nickname is correctly picked up.

  2. Bob receives a Subscription Request which he accepts and adds Alice to his roster.

  3. Alice then receives a Subscription Request asking whether to add Bob to her roster. Once again the nickname field for Bob actually shows his uid. If Alice removes the uid and leaves the field blank she gets the error “Please specify the contact JID (ex. ddman@jabber.org)”

Let me make that doubly clear - when Alice clears the Nickname field on the Subscription request she gets an error asking her to specify the JID, even though this is filled in and is not editable on the Subscription Request form. If Alice doesn’t clear the nickname field on the Subscription Request then Bob is added to her roster but the uid is used as the display name instead of the nickname defined in the vcard.

The difference may also be that I have the server using the Subscription Plugin to automatically Accept All roster addition requests. This means that there is no need for user approval to add users to the roster. I am also using shared groups, one with every user on our system in it.

Hi!

We encounter the same issues as you describe. I read the whole thread and am wondering if someone has found a workaround of solution for this problem? It’s difficult to explain to our users why they see a (for security reasons) unrecognizable name, instead of AD displayname.

Yep, definitely looks like Spark uses the Username (which we have mapped to sAMAccountName) field when prepopulating the Nicname field when you add a user to the roster.

Interestingly I have a test server serving a WebSpark client. Add a user using that an the Nicname is mapped properly according to your ldap.vcard (I have Nicname mapped to displayName).

I set up a test server, disabled encryption and packet traced the get request for the vcard. The ONLY field that is holding the value that is going into the Nicname field on the dialog that pops up when you select Add user is the ‘Username’ field. The ‘NICKNAME’ is being set correctly in the traffic.

Regards,

-Andy

Just hazarding a guess here. (I may need to install SVN and try to build the change).

Take a look at http://www.igniterealtime.org/fisheye/browse/svn-org/spark/branches/spark_2_5_6_ branch/src/java/org/jivesoftware/sparkimpl/search/users/UserSearchResults.java?r =trunk

addContactAction has this block of code (lines 137-158)…

137
RosterDialog dialog = new RosterDialog();
138
String jid = (String)resultsTable.getValueAt(row, 0);
139
140
TableColumn column = null;
141
try {
142
column = resultsTable.getColumn(“Username”);
143
}
144
catch (Exception ex) {
145
try {
146
column = resultsTable.getColumn(“nick”);
147
}
148
catch (Exception e1) {
149
}
150
}
151
if (column != null) {
152
int col = column.getModelIndex();
153
String nickname = (String)resultsTable.getValueAt(row, col);
154
if (!ModelUtil.hasLength(nickname)) {
155
nickname = StringUtils.parseName(jid);
156
}
157
dialog.setDefaultNickname(nickname);
158
}

Note that the try clause attempts to get the ‘Username’ and then fails to ‘nick’. Maybe I’m reading this wrong but it would make more sense if they tried to get the nicname and then failed to Username if it couldn’t be gotten?

Confirmed, patch was slightly wrong though.

The popup dialog is actually populated from a column pulled straight from the search table. The actual column name is ‘Name’ so the fix (diff) is actually as follows.

With this diff applied the Spark client picks up the Name column so as long as you have ‘ldap.nameField = displayName’ on the server that sorts out field mapping properly as the displayName

— UserSearchResults.java.orig 2009-08-24 12:24:25.000000000 +0100
+++ UserSearchResults.java 2009-08-24 12:36:09.000000000 +0100
@@ -139,11 +139,11 @@

             TableColumn column = null;
             try {
  •                column = resultsTable.getColumn("Username");
    
  •                column = resultsTable.getColumn("Name");
               }
               catch (Exception ex) {
                   try {
    
  •                    column = resultsTable.getColumn("nick");
    
  •                    column = resultsTable.getColumn("Username");
                   }
                   catch (Exception e1) {
                       // Nothing to do

Is this enough of a posting for one of the devs to take a look at it?

I notice that the IssueTracker fields you back here so I’m assuming this is enough.

Also, I note that even though I asked for the 2.5.8 trunk when I did my SVN checkout it appears that when my version of Spark builds its actually 2.6.0beta2 :S.

This has limited me a bit because I wanted to check the fix on the other platforms and our standard client is Windows 2.5.8 (and just replacing spark.jar crashes that badly). Anyone know how to check out the old version properly??

Kind regards,

-Andy

1 Like

Actually, I’ll post this in the Spark forum since it is Spark related

Hi. Working solution! ( Ldap displayName shows in Spark add user from search dialog )

I have modified the file UserSearchResults$2.class into Spark\lib\spark.jar\org\jivesoftware\sparkimpl\search\users\ by reJ bytecode editor and changed string constant “Username” to “Name”.

Tested in version 2_7_7, it works.

add_user.jpg