/** * Return the AclProperty relative to a given url * * @param urlPath Location of the CalendarResource * @param httpResponse Response Object for the request. * @return AclProperty xml response or null if missing */ public AclProperty getAcl(HttpResponse httpResponse, String urlPath) { DavProperty p = getDavProperty(httpResponse, urlPath, CalDAVConstants.DNAME_ACL); if (p != null) { try { return AclProperty.createFromXml(p.toXml(DomUtil.createDocument())); } catch (DavException | ParserConfigurationException e) { log.warn("Unable to create AclProperty"); } } return null; }
/** * The ACL method * * @param request * @param response * @param resource * @throws DavException * @throws IOException */ protected void doAcl(WebdavRequest request, WebdavResponse response, DavResource resource) throws DavException, IOException { if (!(resource instanceof AclResource)) { response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED); return; } Document doc = request.getRequestDocument(); if (doc == null) { throw new DavException(DavServletResponse.SC_BAD_REQUEST, "ACL request requires a DAV:acl body."); } AclProperty acl = AclProperty.createFromXml(doc.getDocumentElement()); ((AclResource)resource).alterAcl(acl); }
/** * The ACL method * * @param request * @param response * @param resource * @throws DavException * @throws IOException */ protected void doAcl(WebdavRequest request, WebdavResponse response, DavResource resource) throws DavException, IOException { if (!(resource instanceof AclResource)) { response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED); return; } Document doc = request.getRequestDocument(); if (doc == null) { throw new DavException(DavServletResponse.SC_BAD_REQUEST, "ACL request requires a DAV:acl body."); } AclProperty acl = AclProperty.createFromXml(doc.getDocumentElement()); ((AclResource)resource).alterAcl(acl); }