* @throws PreconditionViolationException
* @throws ServiceAccessException
*/
public void checkPreconditions(String resourcePath, int depth) throws PreconditionViolationException, ServiceAccessException {
if (depth != 0) {
throw new PreconditionViolationException(
new ViolatedPrecondition("depth-must-be-zero",
WebdavStatus.SC_BAD_REQUEST,
"This report is only defined for depth=0."),
resourcePath
);
}
UriPath resourcepath = new UriPath(resourcePath);
NamespaceConfig namespaceConfig = token.getNamespaceConfig();
UriPath userspath = namespaceConfig.getUsersPath() != null
? new UriPath(namespaceConfig.getUsersPath())
: null;
UriPath groupspath = namespaceConfig.getGroupsPath() != null
? new UriPath(namespaceConfig.getGroupsPath())
: null;
UriPath rolespath = namespaceConfig.getRolesPath() != null
? new UriPath(namespaceConfig.getRolesPath())
: null;
if (!resourcepath.equals(userspath) &&
!resourcepath.equals(groupspath) &&
!resourcepath.equals(rolespath)) {
throw new PreconditionViolationException(
new ViolatedPrecondition("valid-request-uri",
WebdavStatus.SC_BAD_REQUEST,
"This report is only defined for one of the collections identified in the value of the DAV:principal-collection-set property."),
resourcePath
);