Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-6964

Expose XWikiContext.getUserReference() to the web API

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Minor
    • 3.2 M3
    • 3.2 M2
    • Old Core
    • None
    • context user reference web api patch
    • Trivial

    Description

      Currently there exists a great deal of confusion when trying to handle local and global users in a virtual wiki because $xcontext.user appears either prefixed or unprefixed with the wiki name from where the user is created.

      The convention is that if you are on the wiki where the user belongs to, $xcontext.user is unprefixed, otherwise it's prefixed.

      While this sounds good in theory, in practice it's very cumbersome to test (say... know if the current user is a global user or not) just by testing strings and problems can occur when not processing the string correctly.

      To fix this, the core class XWikiContext has provided a getUserReference() method that returns a resolved document reference towards the user's profile document that removes ambiguitees.

      The only thing left is to expose this method to the web API so that scripts can use it as well.

      Attachments

        Issue Links

          Activity

            People

              tmortagne Thomas Mortagne
              enygma Eduard Moraru
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: