Re: [xwiki-devs] How to setup 'Prevent unregistered users from viewing pages' in config or programmatically?
I've found a solution: DocumentReference dr = new DocumentReference("xwiki", "XWiki", "XWikiPreferences"); documentAccessBridge.setProperty(dr, dr, "authenticate_view", 1); documentAccessBridge.setProperty(dr, dr, "authenticate_edit", 1); -- View this message in context: http://xwiki.475771.n2.nabble.com/How-to-setup-Prevent-unregistered-users-from-viewing-pages-in-config-or-programmatically-tp7598565p7598600.html Sent from the XWiki- Dev mailing list archive at Nabble.com. ___ devs mailing list devs@xwiki.org http://lists.xwiki.org/mailman/listinfo/devs
Re: [xwiki-devs] How to setup 'Prevent unregistered users from viewing pages' in config or programmatically?
At least I can read these values with the following: Object y1 = documentAccessBridge.getProperty("XWiki.XWikiPreferences", "authenticate_view"); Object y2 = documentAccessBridge.getProperty("XWiki.XWikiPreferences", "authenticate_edit"); -- View this message in context: http://xwiki.475771.n2.nabble.com/How-to-setup-Prevent-unregistered-users-from-viewing-pages-in-config-or-programmatically-tp7598565p7598597.html Sent from the XWiki- Dev mailing list archive at Nabble.com. ___ devs mailing list devs@xwiki.org http://lists.xwiki.org/mailman/listinfo/devs
Re: [xwiki-devs] How to setup 'Prevent unregistered users from viewing pages' in config or programmatically?
Yes, I have found this API and http://platform.xwiki.org/xwiki/bin/view/DevGuide/DsXWikiPreferences too. The problem is I don't understand what to pass to getProperty as params. You wrote: bridge.setProperty(, , "authenticate_view", 1); The following returns null: documentAccessBridge.getProperty("XWiki.XWikiPreferences[0]", "XWiki.XWikiPreferences[0]", "authenticate_view"); Could you write what I should pass to getProperty method, please? And to prevent future questions what should I read to solve such problems? -- View this message in context: http://xwiki.475771.n2.nabble.com/How-to-setup-Prevent-unregistered-users-from-viewing-pages-in-config-or-programmatically-tp7598565p7598593.html Sent from the XWiki- Dev mailing list archive at Nabble.com. ___ devs mailing list devs@xwiki.org http://lists.xwiki.org/mailman/listinfo/devs
Re: [xwiki-devs] How to setup 'Prevent unregistered users from viewing pages' in config or programmatically?
Yes, using the standard APIs for interacting with documents. XWikiDocument doc = xcontext.getWiki().getDocument(, xcontext); doc.setIntValue(, "authenticate_view", 1); doc.setIntValue(, "authenticate_edit", 1); xcontext.getWiki().saveDocument(doc, xcontext); Or, shorter and without using the deprecated old core APIs: @Inject private DocumentAccessBridge bridge; ... bridge.setProperty(, , "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/ ___ devs mailing list devs@xwiki.org http://lists.xwiki.org/mailman/listinfo/devs
Re: [xwiki-devs] How to setup 'Prevent unregistered users from viewing pages' in config or programmatically?
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? -- View this message in context: http://xwiki.475771.n2.nabble.com/How-to-setup-Prevent-unregistered-users-from-viewing-pages-in-config-or-programmatically-tp7598565p7598586.html Sent from the XWiki- Dev mailing list archive at Nabble.com. ___ devs mailing list devs@xwiki.org http://lists.xwiki.org/mailman/listinfo/devs
Re: [xwiki-devs] How to setup 'Prevent unregistered users from viewing pages' in config or programmatically?
Oh, and the value must be 1 to enable. On 03/21/2016 08:29 AM, Sergiu Dumitriu wrote: > That's an object property, so you can use a normal page REST call to set it. > > page: XWiki.XWikiPreferences > object: XWiki.XWikiPreferences[0] > property: authenticate_view / authenticate_edit > > On 03/21/2016 08:07 AM, abtv wrote: >> I would like to deny seen pages for unregistered users. I can do it via the >> following: >> >> Choose `Administration` -> `Users & Groups` -> `Rights` then select >> `Prevent unregistered users from viewing pages, regardless of the page or >> space rights` and >> `Prevent unregistered users from editing pages, regardless of the page or >> space rights`. >> >> But I would like to automate it while deploying xwiki. It means no user >> interactions with UI. Is there any way to do it? Maybe, config file or via >> java extension? >> > > -- Sergiu Dumitriu http://purl.org/net/sergiu/ ___ devs mailing list devs@xwiki.org http://lists.xwiki.org/mailman/listinfo/devs
[xwiki-devs] How to setup 'Prevent unregistered users from viewing pages' in config or programmatically?
I would like to deny seen pages for unregistered users. I can do it via the following: Choose `Administration` -> `Users & Groups` -> `Rights` then select `Prevent unregistered users from viewing pages, regardless of the page or space rights` and `Prevent unregistered users from editing pages, regardless of the page or space rights`. But I would like to automate it while deploying xwiki. It means no user interactions with UI. Is there any way to do it? Maybe, config file or via java extension? -- View this message in context: http://xwiki.475771.n2.nabble.com/How-to-setup-Prevent-unregistered-users-from-viewing-pages-in-config-or-programmatically-tp7598565.html Sent from the XWiki- Dev mailing list archive at Nabble.com. ___ devs mailing list devs@xwiki.org http://lists.xwiki.org/mailman/listinfo/devs