Search in sources :

Example 1 with CalendarResource

use of com.liferay.calendar.model.CalendarResource in project liferay-ide by liferay.

the class CalendarPortlet method addCalendar.

protected void addCalendar(PortletRequest portletRequest, Set<Calendar> calendarsSet, long classNameId, long classPK) throws PortalException, SystemException {
    CalendarResource calendarResource = CalendarResourceUtil.getCalendarResource(portletRequest, classNameId, classPK);
    if (calendarResource == null) {
        return;
    }
    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();
    List<Calendar> calendars = CalendarLocalServiceUtil.getCalendarResourceCalendars(calendarResource.getGroupId(), calendarResource.getCalendarResourceId());
    for (Calendar calendar : calendars) {
        if (!CalendarPermission.contains(permissionChecker, calendar, ActionKeys.VIEW)) {
            continue;
        }
        calendarsSet.add(calendar);
    }
}
Also used : PermissionChecker(com.liferay.portal.security.permission.PermissionChecker) Calendar(com.liferay.calendar.model.Calendar) CalendarResource(com.liferay.calendar.model.CalendarResource) ThemeDisplay(com.liferay.portal.theme.ThemeDisplay)

Aggregations

Calendar (com.liferay.calendar.model.Calendar)1 CalendarResource (com.liferay.calendar.model.CalendarResource)1 PermissionChecker (com.liferay.portal.security.permission.PermissionChecker)1 ThemeDisplay (com.liferay.portal.theme.ThemeDisplay)1