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

When creating a new wiki, use the XWikiDocument class to save the wiki descriptor and not the api.Document class

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 3.2 M3
    • 3.2 M2
    • {Unused} Wiki Manager
    • None
    • wiki manager core api create wiki limitation patch
    • Unknown

    Description

      The wiki manager plugin works with web api classes such as Document and that is good for when it is called from velocity or from its plugin API, but the problem is that internally, it also uses web api classes instead of using core classes like XWikiDocument:

      wikiSuperDocToSave.save(comment);
      

      One problem that this behaviour is causing is that the plugin api makes user rights check and document PR check on wiki creation, but the, it checks a second time, internally, when saving the wiki descriptor by using Document.save(). This is messing things up for code that wants to allow regular users to create wikis (like the workspaces feature) because the "convention" of "platform code uses core model directly without extra checks; web code uses web api and does all the checking" is not enforced.

      The solution (here) is simple:

      XWikiDocument wikiSuperXDocToSave = wikiSuperDocToSave.getDocument();
      context.getWiki().saveDocument(wikiSuperXDocToSave, comment, context);
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: