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

xwiki.getDocumentAsAuthor is broken when used in a template

    XMLWordPrintable

Details

    • Unit
    • Unknown
    • N/A
    • N/A

    Description

      Or any other use case where the executed code is not located in the context document content.

      api.XWiki.getEffectiveScriptAuthorName() returns the author of the current document instead of using the author reference given in the context.

      As a result, calling xwiki.getDocumentAsAuthor() in a template from a thread (without any current document) badly fallback to the author of a stub document (the current document) and finally returned the document only if guest user has the right to see it.

      Note that context.getAuthorReference() returned the accurate value (superadmin in the case of a template of the file system) and that we should rely on it.

      Attachments

        Issue Links

          Activity

            People

              tmortagne Thomas Mortagne
              gdelhumeau Guillaume Delhumeau
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: