Jetspeed 2
  1. Jetspeed 2
  2. JS2-685

Add functionality to AJAX API to information about users

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.2
    • Fix Version/s: 2.1.2
    • Component/s: Ajax
    • Labels:
      None
    • Environment:
      Any

      Description

      In the patch there are two Jetspeed AJAX API actions; getuserinfo and getuserlist.

      Action getuserinfo:

      action: getuserinfo
      params: none

      This AJAX API action will retreave information about the currently logged in user. If user if not logged in, status failure is returned. It will return this information:

      • username
      • principal class
      • full list of user information (names, email, etc...)

      Here's an example output:

      <js>
      <status>success</status>
      <action>userinformation</action>
      <username>admin</username>
      <type>org.apache.jetspeed.security.impl.UserPrincipalImpl</type>
      <userinfo>
      <user.name.given>Test Dude</user.name.given>
      <user.name.family>Dudley</user.name.family>
      </userinfo>
      </js>

      Action getuserlist:

      This action will return a list of currently logged in users with username and ipaddress and optionally offline users, userinformation and number of guest sessions.

      action: getuserlist
      guest: true | false (default) ; return number of guest sessions
      userinfo: true | false (default); return full userinformation if available
      offline: true | false (default); return list of offline users
      all: true | false (default); return everything

      Here's an example output with all set to true:

      <js>
      <status>success</status>
      <action>getuserlist</action>
      <users>
      <user>
      <username>admin</username>
      <sessions>1</sessions>
      <status>online</status>
      <ipaddress>127.0.0.1</ipaddress>
      <userinfo>
      <user.name.given>Test Dude</user.name.given>
      <user.name.family>Dudley</user.name.family>
      </userinfo>
      </user>
      <user>
      <username>user</username>
      <status>offline</status>
      </user>
      <guests>0</guests>
      </users>
      </js>

        Activity

        Hide
        Mikko Wuokko added a comment -

        This patch will add two now AJAX API actions which can be used to retreave userinformation.

        Show
        Mikko Wuokko added a comment - This patch will add two now AJAX API actions which can be used to retreave userinformation.
        Hide
        David Sean Taylor added a comment -

        Patch applied and tested.
        Would be nice to have documentation (xdocs) for the new apis added to guides/guide-ajax-api.xml....

        Show
        David Sean Taylor added a comment - Patch applied and tested. Would be nice to have documentation (xdocs) for the new apis added to guides/guide-ajax-api.xml....
        Hide
        Mikko Wuokko added a comment -

        Wrote some xdocs for the new APIs and added a feature for the "getuserlist" API to modify the protection level for the SecurityBehavior. The new constructor parameter protectionScope can have values of "all", "private-offline," "private" (default) and "none". If set to all, the api will return just failure unless the SecurityBehaviour will grant access. If set to "private-offline", the basic info of online users and guest session count will be shown to everyone, but the extended userinfo only to priviledged users. The "private" is the same, but will include the offline users too. If set to "none", everything will be shown to every, which might not be wise, though, on a production server.

        I added that extra feature so that the online userinfo can be used for example in user status portlets.

        Show
        Mikko Wuokko added a comment - Wrote some xdocs for the new APIs and added a feature for the "getuserlist" API to modify the protection level for the SecurityBehavior. The new constructor parameter protectionScope can have values of "all", "private-offline," "private" (default) and "none". If set to all, the api will return just failure unless the SecurityBehaviour will grant access. If set to "private-offline", the basic info of online users and guest session count will be shown to everyone, but the extended userinfo only to priviledged users. The "private" is the same, but will include the offline users too. If set to "none", everything will be shown to every, which might not be wise, though, on a production server. I added that extra feature so that the online userinfo can be used for example in user status portlets.
        Hide
        David Sean Taylor added a comment -

        Applied the patch. Great new feature with the protection scoping.
        XDocs are published to apache site

        Show
        David Sean Taylor added a comment - Applied the patch. Great new feature with the protection scoping. XDocs are published to apache site

          People

          • Assignee:
            David Sean Taylor
            Reporter:
            Mikko Wuokko
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development