[Nuxeo web mobile] multi tenancy and mobile site root button
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2015 04:44 AM
Hi There,
I noticed that when using the web mobile package and the multi tenancy package the root button results into an error page.
For testing I edited the class "MobileApplication.java", specifically the following method:
/**
* Generate the root view of the repository. First root descendant and user workspace are rendered
*/
@GET
@Path("root")
public Object getRootRepositoryView() throws Exception {
Map<String, Object> args = new HashMap<String, Object>();
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);
}
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.
It works for me but is it a good solution (Could you use it as well?)?
Thanks in advance,
Bauke Roo
0 REPLIES 0
