Do we have an alternative ? JV.
On Thu, Feb 11, 2010 at 6:09 PM, Sergiu Dumitriu <[email protected]> wrote: > On 02/11/2010 05:49 PM, vmassol (SVN) wrote: >> Author: vmassol >> Date: 2010-02-11 17:49:55 +0100 (Thu, 11 Feb 2010) >> New Revision: 26953 >> >> Modified: >> platform/web/trunk/standard/src/main/webapp/templates/xwikivars.vm >> Log: >> Improved doc >> >> Modified: platform/web/trunk/standard/src/main/webapp/templates/xwikivars.vm >> =================================================================== >> --- platform/web/trunk/standard/src/main/webapp/templates/xwikivars.vm >> 2010-02-11 16:07:23 UTC (rev 26952) >> +++ platform/web/trunk/standard/src/main/webapp/templates/xwikivars.vm >> 2010-02-11 16:49:55 UTC (rev 26953) >> @@ -3,7 +3,9 @@ >> #set($isSuperAdmin = ($context.user == 'XWiki.superadmin')) >> #set($hasEdit = $xwiki.hasAccessLevel("edit")) >> #set($hasAdmin = $xwiki.hasAccessLevel("admin")) > > This is so bad for the performance... Fills the cache with unneeded > entries, makes two unneeded queries to the database (the random document > plus the WebPreferences), and goes through the complex full rights check > each time. > >> +## Note: In order to know if the user has the right to create a space we >> compute a space name that doesn't exist and check edit rights on that space >> #set($hasCreateSpace = $xwiki.hasAccessLevel("edit", >> "${doc.space}${mathtool.random(0, >> 999)}.DocumentReservedForInternalXWikiUsage")) >> +## Note: In order to know if the user has the right to create a page we >> compute a page name that doesn't exist and check edit rights on that page >> #set($hasCreatePage = $xwiki.hasAccessLevel("edit", >> "${doc.space}.DocumentReservedForInternalXWikiUsage${mathtool.random(0, >> 999)}")) >> #set($hasGlobalAdmin = $xwiki.hasAccessLevel("admin", $context.user, >> "XWiki.XWikiPreferences")) >> #set($hasSpaceAdmin = $xwiki.hasAccessLevel("admin", $context.user, >> "${doc.space}.WebPreferences")) > > > -- > Sergiu Dumitriu > http://purl.org/net/sergiu/ > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs > _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

