<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic [Nuxeo web mobile] multi tenancy and mobile site root button in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-web-mobile-multi-tenancy-and-mobile-site-root-button/m-p/322143#M9144</link>
    <description>&lt;P&gt;Hi There,&lt;/P&gt;
&lt;P&gt;I noticed that when using the web mobile package and the multi tenancy package the root button results into an error page.&lt;/P&gt;
&lt;P&gt;For testing I edited the class "MobileApplication.java", specifically the following method:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;     /**
 * Generate the root view of the repository. First root descendant and user workspace are rendered
 */
@GET
@Path("root")
public Object getRootRepositoryView() throws Exception {
    Map&amp;lt;String, Object&amp;gt; args = new HashMap&amp;lt;String, Object&amp;gt;();

    CoreSession session = ctx.getCoreSession();

//added possibility to get tenantId
DocumentModel doc;
try{
	MultiTenantPrincipal principal = (MultiTenantPrincipal) session.getPrincipal();
	String tenantId = principal.getTenantId();
	doc = session.getDocument(new PathRef("/"+tenantId));
}
catch(Exception e){ 
	doc = session.getRootDocument();
}
    DocumentModelList children;
    do {
        children = session.getChildren(doc.getRef(), null, ONLY_VISIBLE_CHILDREN, null);
        if (children.size() == 1) {
            doc = children.get(0);
        }
    } while (children.size() == 1);
    args.put("domain", children);

    setCurrentPage(ToolbarPage.BROWSE);
    return getView("root").args(args);
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The idea is to try of a user has a tenantId and if so use it as the root doc, if not use the getRootDocument() method.&lt;/P&gt;
&lt;P&gt;It works for me but is it a good solution (Could you use it as well?)?&lt;/P&gt;
&lt;P&gt;Thanks in advance,&lt;/P&gt;
&lt;P&gt;Bauke Roo&lt;/P&gt;</description>
    <pubDate>Wed, 28 Jan 2015 09:44:02 GMT</pubDate>
    <dc:creator>Bauke_Roo</dc:creator>
    <dc:date>2015-01-28T09:44:02Z</dc:date>
    <item>
      <title>[Nuxeo web mobile] multi tenancy and mobile site root button</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-web-mobile-multi-tenancy-and-mobile-site-root-button/m-p/322143#M9144</link>
      <description>&lt;P&gt;Hi There,&lt;/P&gt;
&lt;P&gt;I noticed that when using the web mobile package and the multi tenancy package the root button results into an error page.&lt;/P&gt;
&lt;P&gt;For testing I edited the class "MobileApplication.java", specifically the following method:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;     /**
 * Generate the root view of the repository. First root descendant and user workspace are rendered
 */
@GET
@Path("root")
public Object getRootRepositoryView() throws Exception {
    Map&amp;lt;String, Object&amp;gt; args = new HashMap&amp;lt;String, Object&amp;gt;();

    CoreSession session = ctx.getCoreSession();

//added possibility to get tenantId
DocumentModel doc;
try{
	MultiTenantPrincipal principal = (MultiTenantPrincipal) session.getPrincipal();
	String tenantId = principal.getTenantId();
	doc = session.getDocument(new PathRef("/"+tenantId));
}
catch(Exception e){ 
	doc = session.getRootDocument();
}
    DocumentModelList children;
    do {
        children = session.getChildren(doc.getRef(), null, ONLY_VISIBLE_CHILDREN, null);
        if (children.size() == 1) {
            doc = children.get(0);
        }
    } while (children.size() == 1);
    args.put("domain", children);

    setCurrentPage(ToolbarPage.BROWSE);
    return getView("root").args(args);
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The idea is to try of a user has a tenantId and if so use it as the root doc, if not use the getRootDocument() method.&lt;/P&gt;
&lt;P&gt;It works for me but is it a good solution (Could you use it as well?)?&lt;/P&gt;
&lt;P&gt;Thanks in advance,&lt;/P&gt;
&lt;P&gt;Bauke Roo&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jan 2015 09:44:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/nuxeo-web-mobile-multi-tenancy-and-mobile-site-root-button/m-p/322143#M9144</guid>
      <dc:creator>Bauke_Roo</dc:creator>
      <dc:date>2015-01-28T09:44:02Z</dc:date>
    </item>
  </channel>
</rss>

