public CalendarController createCalendarController(UserRequest ureq, WindowControl wControl, BusinessGroup businessGroup, boolean isAdmin) {
// do not use a global translator since in the fututre a collaborationtools
// may be shared among users
List<KalendarRenderWrapper> calendars = new ArrayList<KalendarRenderWrapper>();
// get the calendar
CalendarManager calManager = CalendarManagerFactory.getInstance().getCalendarManager();
KalendarRenderWrapper calRenderWrapper = calManager.getGroupCalendar(businessGroup);
boolean isOwner = ManagerFactory.getManager().isIdentityInSecurityGroup(ureq.getIdentity(), businessGroup.getOwnerGroup());
if (!(isAdmin || isOwner)) {
// check if participants have read/write access
int iCalAccess = CollaborationTools.CALENDAR_ACCESS_OWNERS;
Long lCalAccess = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup).lookupCalendarAccess();
if (lCalAccess != null) iCalAccess = lCalAccess.intValue();
if (iCalAccess == CollaborationTools.CALENDAR_ACCESS_ALL) {
calRenderWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_WRITE);
} else {
calRenderWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_ONLY);
}
} else {
calRenderWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_WRITE);
}
KalendarConfig config = calManager.findKalendarConfigForIdentity(calRenderWrapper.getKalendar(), ureq);
if (config != null) {
calRenderWrapper.getKalendarConfig().setCss(config.getCss());
calRenderWrapper.getKalendarConfig().setVis(config.isVis());
}
calRenderWrapper.getKalendarConfig().setResId(businessGroup.getKey());