Beispiel #1
1
  public static List<Calendar> getUserGroupCalendars(PermissionChecker permissionChecker)
      throws PortalException, SystemException {

    List<Calendar> calendars = new ArrayList<Calendar>();

    long classNameId = PortalUtil.getClassNameId(Group.class.getName());

    List<CalendarResource> calendarResources =
        CalendarResourceServiceUtil.search(
            permissionChecker.getCompanyId(),
            new long[] {},
            new long[] {classNameId},
            null,
            true,
            true,
            QueryUtil.ALL_POS,
            QueryUtil.ALL_POS,
            null);

    for (CalendarResource calendarResource : calendarResources) {
      for (Calendar calendar : calendarResource.getCalendars()) {
        if (CalendarPermission.contains(permissionChecker, calendar, ActionKeys.VIEW)) {

          calendars.add(calendar);
        }
      }
    }

    return calendars;
  }
Beispiel #2
1
  public static List<Calendar> getUserCalendars(long userId)
      throws PortalException, SystemException {

    long classNameId = PortalUtil.getClassNameId(User.class.getName());

    CalendarResource calendarResource =
        CalendarResourceServiceUtil.fetchCalendarResource(classNameId, userId);

    return calendarResource.getCalendars();
  }