Hi Edvorg,

  the error message means some pages (probably either XWiki/.ocumentTree or 
XWiki.DocumentTreeMacros)
has lost their "programming rights", because they have been edited by a user 
without programming rights.

 One option is that you have denied the "Admin" user the programming rights via 
your listener,
by editing the first "XWiki.XWikiGlobalRights" object in the preferences, and 
that previously
gave programming rights to the "XWiki.XWikiAdminGroup" .

 You should be able to check this by viewing the XWiki.XWikiPreferences page in 
the object editor
and inspect its XWiki.XWikiGlobalRights" object.

 To avoid this, your code should loop over all "XWiki.XWikiGlobalRights" of the 
preferences page, and modify the one
which has a value for "groups" as "XWiki.XWikiAllGroup" and a "allow" == 1, 
possibly creating such an object if it does not exist

Hope this helps
Clemens


P.S.: the code in your mail looks somewhat unformatted. Maybe you send it as 
HTML mail?
The mailinglist software only delivers plain text mail, so it might be better 
to only send plain text mails, too


Edvorg  wrote:
> Hello. I'm trying to grant page delete right for all registered users.I'm
> doing it by running this code in onEvent method of my
> ApplicationReadyEventListenerif (contextProvider != null) {    XWikiContext
> context = contextProvider.get();    if (context != null) {        XWiki
> xwiki = context.getWiki();        DocumentReference dr = new
> DocumentReference("xwiki", "XWiki", "XWikiPreferences");       
> XWikiDocument doc = xwiki.getDocument(dr, context);        BaseObject bo =
> doc.getObject("XWiki.XWikiGlobalRights", true, context);       
> bo.set("groups", "XWiki.XWikiAllGroup", context);        bo.set("levels",
> "view,comment,edit,script,delete", context);        bo.set("users", "",
> context);        bo.set("allow", 1, context);        xwiki.saveDocument(doc,
> context);    }}It does the job, but causes a new issue. Tree view on my page
> stops working showing infinite loading whentrying to expand a node. The
> browser developer tools shows me this exception:
> https://gist.github.com/edvorg/acff4a58342edfa3485791a7ba57e172
> <https://gist.github.com/edvorg/acff4a58342edfa3485791a7ba57e172>  
> 
> 
> 
> --
> View this message in context: 
> http://xwiki.475771.n2.nabble.com/tree-view-macro-stops-working-after-changing-XWikiGlobalRights-tp7600229.html
> Sent from the XWiki- Dev mailing list archive at Nabble.com.
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
> 
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to