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;
}
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);
}
}
Aggregations