title: Set user and group rights to document in XWiki
body: <p>I'm writing a java component which build all the pages in a wiki. What would be the best way to assign the user rights or groups which may view the page or spaces from within the java service component? 
  Really struggling to find details on this in the API.</p>