use of org.olat.modules.portfolio.model.BinderRefImpl in project openolat by klemens.
the class BinderContextEntryControllerCreator method getTabContext.
@Override
public TabContext getTabContext(UserRequest ureq, OLATResourceable ores, ContextEntry mainEntry, List<ContextEntry> entries) {
Identity identity = ureq.getIdentity();
PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
Long binderKey = mainEntry.getOLATResourceable().getResourceableId();
BinderRef binder = new BinderRefImpl(binderKey);
List<ContextEntry> rewritedEntries = new ArrayList<ContextEntry>();
OLATResourceable homeRes = OresHelper.createOLATResourceableInstance("HomeSite", identity.getKey());
rewritedEntries.add(BusinessControlFactory.getInstance().createContextEntry(homeRes));
rewritedEntries.add(BusinessControlFactory.getInstance().createContextEntry(OresHelper.createOLATResourceableInstance("PortfolioV2", 0l)));
if (portfolioService.isMember(binder, identity, PortfolioRoles.owner.name())) {
rewritedEntries.add(BusinessControlFactory.getInstance().createContextEntry(OresHelper.createOLATResourceableInstance("MyBinders", 0l)));
} else if (portfolioService.isMember(binder, identity, PortfolioRoles.coach.name(), PortfolioRoles.reviewer.name())) {
rewritedEntries.add(BusinessControlFactory.getInstance().createContextEntry(OresHelper.createOLATResourceableInstance("SharedWithMe", 0l)));
}
// Binder
rewritedEntries.add(mainEntry);
if (entries != null && !entries.isEmpty()) {
// more details
rewritedEntries.addAll(entries);
}
// -> HomeSite
return new TabContext("", homeRes, rewritedEntries);
}
Aggregations