Search in sources :

Example 1 with CalendarResourceBy

use of com.zimbra.common.account.Key.CalendarResourceBy in project zm-mailbox by Zimbra.

the class GetCalendarResource method handle.

@Override
public Element handle(Element request, Map<String, Object> context) throws ServiceException {
    ZimbraSoapContext zsc = getZimbraSoapContext(context);
    Provisioning prov = Provisioning.getInstance();
    GetCalendarResourceRequest req = JaxbUtil.elementToJaxb(request);
    boolean applyCos = !Boolean.FALSE.equals(req.getApplyCos());
    CalendarResourceBy calresBy = req.getCalResource().getBy().toKeyCalendarResourceBy();
    String value = req.getCalResource().getKey();
    CalendarResource resource = prov.get(calresBy, value);
    defendAgainstCalResourceHarvesting(resource, calresBy, value, zsc, Admin.R_getCalendarResourceInfo);
    AdminAccessControl aac = checkCalendarResourceRight(zsc, resource, AdminRight.PR_ALWAYS_ALLOW);
    Element response = zsc.createElement(AdminConstants.GET_CALENDAR_RESOURCE_RESPONSE);
    Set<String> reqAttrs = getReqAttrs(req.getAttrs(), AttributeClass.calendarResource);
    ToXML.encodeCalendarResource(response, resource, applyCos, reqAttrs, aac.getAttrRightChecker(resource));
    return response;
}
Also used : GetCalendarResourceRequest(com.zimbra.soap.admin.message.GetCalendarResourceRequest) ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext) CalendarResourceBy(com.zimbra.common.account.Key.CalendarResourceBy) Element(com.zimbra.common.soap.Element) CalendarResource(com.zimbra.cs.account.CalendarResource) Provisioning(com.zimbra.cs.account.Provisioning)

Example 2 with CalendarResourceBy

use of com.zimbra.common.account.Key.CalendarResourceBy in project zm-mailbox by Zimbra.

the class AdminDocumentHandler method defendAgainstAccountOrCalendarResourceHarvestingWhenAbsent.

protected void defendAgainstAccountOrCalendarResourceHarvestingWhenAbsent(AccountBy accountBy, String selectorKey, ZimbraSoapContext zsc, AdminRight rightForAcct, AdminRight rightForCalRes) throws ServiceException {
    try {
        CalendarResourceBy calResBy = CalendarResourceBy.fromString(accountBy.toString());
        defendAgainstCalResourceHarvestingWhenAbsent(calResBy, selectorKey, zsc, new CalResourceHarvestingCheckerUsingCheckCalendarResourceRight(zsc, rightForCalRes));
    } catch (ServiceException e) {
        defendAgainstAccountHarvestingWhenAbsent(accountBy, selectorKey, zsc, rightForAcct);
    }
}
Also used : AccountServiceException(com.zimbra.cs.account.AccountServiceException) ServiceException(com.zimbra.common.service.ServiceException) CalendarResourceBy(com.zimbra.common.account.Key.CalendarResourceBy)

Aggregations

CalendarResourceBy (com.zimbra.common.account.Key.CalendarResourceBy)2 ServiceException (com.zimbra.common.service.ServiceException)1 Element (com.zimbra.common.soap.Element)1 AccountServiceException (com.zimbra.cs.account.AccountServiceException)1 CalendarResource (com.zimbra.cs.account.CalendarResource)1 Provisioning (com.zimbra.cs.account.Provisioning)1 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)1 GetCalendarResourceRequest (com.zimbra.soap.admin.message.GetCalendarResourceRequest)1