On Wed, Dec 9, 2015 at 8:33 AM, gervwyk <gervwyk(a)gmail.com> wrote:
  How do I get all the spaces for which the current user
has access in a java
 component?
 
Why do you need this? There can be many spaces. Starting with XWiki 7.2 you
can have nested documents and each nested document has an associated space
which means you can have as many spaces as pages (e.g. thousands). More
over, we cannot write a database query to retrieve the spaces (or the
pages) the user has access to because access rights are defined at multiple
levels (page, space, wiki, farm) that inherit from one another. This means
you have to check the access rights for each space (or page) separately.
Writing a query to retrieve all the spaces (or pages) and then check the
access on each of them is very costly. I wouldn't do it.
In any case, I added 2 examples to
http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module#HQueryLan…
on how to use the new XWikiSpace table (7.2+)
Hope this helps,
Marius
 I have the following:
 List<String> lstSpaces = new ArrayList<String>();
 XWikiContext xcontext = this.xwikiContextProvider.get();
 XWiki xwiki = xcontext.getWiki();
 lstSpaces = xwiki.getSpaces(xcontext);
 Although this successfully returns all the spaces, it also returns the
 spaces for which the current user has no "view" or other access rights.
 Also
 it seems that the Java .getSpaces is deprecated and I can't seem to find
 the
 new method for this. 
http://maven.xwiki.org/site/docs/xwiki-javadoc-5.0.x/
 seems outdated as xwiki.getSpaces() is still active in this javadoc, with
 no
 alternative. Is there a new javadoc availible?
 --
 View this message in context:
http://xwiki.475771.n2.nabble.com/spaces-for-which-the-current-user-has-acc…
 Sent from the XWiki- Users mailing list archive at 
Nabble.com.
 _______________________________________________
 users mailing list
 users(a)xwiki.org
 
http://lists.xwiki.org/mailman/listinfo/users