Details
-
Bug
-
Resolution: Duplicate
-
Major
-
None
-
3.0
-
template rights owner
-
N/A
-
N/A
-
Description
How to reproduce:
1. Run this from the main wiki using a "cleantemplate" wiki created with a default xe xar:
{{velocity}} #set ($name = "testtt3") #set ($templateName = "cleantemplate") #set ($WikiManager = $xwiki.wikimanager) #set ($wikidocument = $WikiManager.createWikiDocument()) #set ($wikidocumentobject = $wikidocument.createXObject("XWiki.XWikiServerClass")) Set: $wikidocument.set("owner", "xwiki:XWiki.Admin") $wikidocument.set("server", $name) $wikidocument.set("visibility", "Public") $wikidocument.set("state", "active") $wikidocument.set("homepage", "Main.WebHome") Get: $wikidocument.owner $wikidocument.server $wikidocument.visibility $wikidocument.state $wikidocument.homepage Creating... #set ($result = $WikiManager.createNewWiki($name, $templateName, "", $wikidocument, true)) Result: $result #set ($currentDatabase = $xcontext.database) #set ($ok = $xcontext.setDatabase($name)) Changed DB. Testing "$wikidocument.wikiName:XWiki.XWikiPreferences" for admin $xwiki.hasAccessLevel("admin", "xwiki:$xcontext.user", "$wikidocument.wikiName:XWiki.XWikiPreferences") edit $xwiki.hasAccessLevel("edit", "xwiki:$xcontext.user", "$wikidocument.wikiName:XWiki.XWikiPreferences") view $xwiki.hasAccessLevel("view", "xwiki:$xcontext.user", "$wikidocument.wikiName:XWiki.XWikiPreferences") rights to user "xwiki:$xcontext.user" Same, but for relative references: $xcontext.user - "XWiki.XWikiPreferences" $xwiki.hasAccessLevel("admin", $xcontext.user, "XWiki.XWikiPreferences") $xwiki.hasAccessLevel("edit", $xcontext.user, "XWiki.XWikiPreferences") $xwiki.hasAccessLevel("view", $xcontext.user, "XWiki.XWikiPreferences") Same but with absolute user: "xwiki:$xcontext.user" - "XWiki.XWikiPreferences" $xwiki.hasAccessLevel("admin", "xwiki:$xcontext.user", "XWiki.XWikiPreferences") $xwiki.hasAccessLevel("edit", "xwiki:$xcontext.user", "XWiki.XWikiPreferences") $xwiki.hasAccessLevel("view", "xwiki:$xcontext.user", "XWiki.XWikiPreferences") Restoring db. #set ($ok = $xcontext.setDatabase($currentDatabase)) {{/velocity}}
Output:
Set: Get: xwiki:XWiki.Admin testtt3 Public active Main.WebHome Creating... Result: -1 Changed DB. Testing "testtt3:XWiki.XWikiPreferences" for admin true edit true view true rights to user "xwiki:XWiki.Admin" Same, but for relative references: XWiki.Admin - "XWiki.XWikiPreferences" false false false Same but with absolute user: "xwiki:XWiki.Admin" - "XWiki.XWikiPreferences" true true true Restoring db.
Notice that the second attempt fails, reporting that the owner does not have rights.
Attachments
Issue Links
- duplicates
-
XWIKI-6103 Introduce APIs using References for context user
- Closed