You are here: Main » MigrationNPS » UserinfoSyntax

Person and address information on our website

Describes how users can store their address info in Active Directory and how NPS web authors can insert tables of such information into web pages.

Note: The solution described herein is currently disabled, because the connection of the servlet to the LDAP/ActiveDirectory server tends to fail (once and for all) after some time for reasons we do not understand and could not find despite our best efforts. Sorry. As a replacement, user information is modeled directly in NPS, which is a partially manual, but rather flexible solution.


Displaying address info: The /ldap/userinfo servlet

All of our four servers www.[mi|inf|math|fbv].fu-berlin.de have the same Java/Jython servlet running for retrieving user information from our central Fachbereich-wide Active Directory server and displaying it in form of HTML tables.

NPS web page authors can insert calls to this servlet on arbitrary web pages.

Here is how the calls look like on an NPS page

<div id="userinfo1">
  For the people list, see 
  <a class="userinfolink" jtarget="userinfo1"
     href="/ldap/userinfo?group=org_agse&columns=fullname@homepage;email@email;street,room;phone&sort=lastname&lang=en"
  >/ldap/userinfo</a>.
</div> 

You may vary the text and the part of the href attribute after the ?, but all other tags and attributes must be exactly as shown. (Exception: For putting multiple userinfo tables onto the same page, you can exchange the two appearances of "userinfo1" to "userinfo2" etc. But you must always change both of them together.)

How it works internally

NPS pages are purely static pages. However, people information is dynamically extracted from Active Directory. How can that work?

As shown above, the NPS page just contains a link. If you follow that link, you will call a 'naked' page (outside of NPS) that will contain only the people information and nothing else.

But that is obviously an ugly solution.

Therefore, the above section (because it is marked with class="userinfolink") is normally processed by a Javascript routine that you can load into the respective NPS page. This Javascript performs the call described in the href and inserts the resulting HTML table in place of the current contents of the div element.

How to active the Javascript

Insert the following in the head section of your page:

Everything else happens automatically. The code activates itself as soon as the page has finished loading.

Parameters for configuring the people information

After the ? in the href, you can use the following arguments to select what will be included in the resulting HTML table:

  • group: a comma-separated list of Active Directory org_* group names. The union of the members of all of these groups will be included in the table, one line per member.
  • user: a comma-separated list of individual usernames that will also be included in the table. You can use either group or user or both.
  • columns: a list of field names whose contents will be included for each member. Semicolon as a separator indicates using a new column, using comma as a separator indicates using a new line within a column (i.e. within the same table cell), @ as a separator indicates hyperlink creation (the left operand provides the link text, the right operand provides the URL). The field names will be explained below.
  • lang: Language used in the output table. Possible values are "en" (English) and "de" (Deutsch). This selects different text for the column headers and also a different format for telephone numbers (international vs. national).
  • sort: Name of the field to be used as a sorting criterion for the lines of the table.
  • refresh: If 1, the servlet's internal cache will be updated with new data from Active Directory with respect to the given values of group and user. If 0 or not given, cached data will be used. refresh is needed only to make the servlet reflect changes in the contents of the Active Directory.

Available fields

Here is a table describing the columns you can have in a userinfo table:

Nr userinfo name Active Directory name "en" title "de" title
1 cn cn Username Benutzername
2 fullname displayName Name Name
3 firstname givenName Given Name Vorname
4 lastname sn Family Name Nachname
5 email mail Email Email
6 phone telephoneNumber Phone Telefon
7 shortphone   Extension Durchwahl
8 fax facsimileTelephoneNumber Fax Fax
9 shortfax   Fax ext. Fax
10 mobile mobile Mobile Mobil
11 street streetAddress Street Straße
12 room physicalDeliveryOfficeName Room no. Raum
13 buildingroom   Room no. Raum
14 ag department Work group Arbeitsgruppe
15 jobtitle title Job title Jobtitel
16 homepage wWWHomePage Homepage Webseite

Explanation of the columns in the above table:
  • Nr: will be used below for describing how you can enter this data yourself.
  • userinfo name: The name of the field to be used in the call to the userinfo servlet.
  • Active Directory name: The internal name of the field. (This is relevant only for the programmers of the userinfo servlet, not for its users.)
  • "en" title: The column header printed for this field in the userinfo table if lang=en.
  • "de" title: The column header printed for this field in the userinfo table if lang=de.

Explaining the fields themselves (in terms of the userinfo name):
  • cn: The account name of the person. Always predefined.
  • fullname: The full name (firstname lastname) of the person.
  • email: A mangled version of the email address. If "fu-berlin.de" is present in the Active Directory mail field, it will be replaced by "..." for spam protection.
  • shortphone: Only the extension part extracted from the full university phone number.
  • street: The last line of the multi-line streetAddress field.
  • buildingroom: Composed of an abbreviation of the street field plus the room field (say "T9.014"). This works only for the standard buildings, e.g. "Takustr. 9" (note the "str." not "straße") will become "T9" etc.
  • ag: The name of the group within the institute
  • homepage: a URL leading to a person's homepage. If no value is entered explicitly, the userinfo servlet will guess that it is http://page.mi.fu-berlin.de/~username (where username is the value of cn).

The other fields' meaning should be obvious.

Where possible, the userinfo servlet will compute some data from others, but explicitly entered data is prefered; see below.

Entering address info: The Windows 'Find people' dialog

By default, only little information is present in Active Directory for any one person. But everybody can modify his or her own Active Directory person record easily as follows:

  • Log in to a Windows machine
  • Start Start→Search→For People... (in a german Windows installation, the labels will be different, but meaning and behavior are the same)
  • Search for yourself as follows:

  • Fill in the dialogs of each tab as shown in the images below. The numbers in the annotations refer to the fields as numbered in the field description table above.

  • Press OK
  • Now make sure you call userinfo with refresh turned on to invalidate the servlet's cache.

TO DO list

The following improvements are planned to be done to userinfo in the future:

  • Automatic generation of a refresh link in the HTML output

Comments

Add comments here:

 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback