Yes, using the standard APIs for interacting with documents.
XWikiDocument doc = xcontext.getWiki().getDocument(<reference to
XWiki.XWikiPreferences>, xcontext);
doc.setIntValue(<reference to XWiki.XWikiPreferences>,
"authenticate_view", 1);
doc.setIntValue(<reference to XWiki.XWikiPreferences>,
"authenticate_edit", 1);
xcontext.getWiki().saveDocument(doc, xcontext);
Or, shorter and without using the deprecated old core APIs:
@Inject
private DocumentAccessBridge bridge;
...
bridge.setProperty(<reference to XWiki.XWikiPreferences>, <reference to
XWiki.XWikiPreferences>, "authenticate_view", 1);
On 03/22/2016 03:33 AM, abtv wrote:
It's good idea, but I would prefer to use java
code in xwiki instead of REST
call from outside of xwiki. Is it possible?
--
Sergiu Dumitriu
http://purl.org/net/sergiu/