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

Saving/Creating a document that is not located on the current wiki sets the author relative to the current wiki instead of the wiki of the saved document.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.3, 3.4-milestone-1
    • 3.3-rc-1
    • Old Core
    • None
    • save create document author creator subwiki
    • Unknown

    Description

      Doing something like this from the main wiki while logged in as xwiki:XWiki.Admin (global admin):

      #set ($documentOnAnotherWiki = $xwiki.getDocument('someWiki:Space.Page'))
      $documentOnAnotherWiki.setContent('newContent')
      $documentOnAnotherWiki.save('modified')
      

      Will result in a modification done by someWiki:XWiki.Admin (local admin) in the 'someWiki' subwiki.

      This is because the Document.saveDocument() method gets the author from XWikiContext.getUser() which, in turn, uses the XWikiContext.getDatabase() wiki for the compactWikiEntityReferenceSerializer to resolve the user string instead of using the saved document's wiki.

      The solution is to use the user references and the previous translation problems are automatically resolved.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: