Details
-
Improvement
-
Resolution: Fixed
-
Major
-
3.2 M2
-
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);