WebDAV permissions and logging (closes #1362)
This commit is contained in:
@@ -16,7 +16,10 @@ pub async fn test(test: &WebDavTest) {
|
||||
.await
|
||||
.with_header(
|
||||
"dav",
|
||||
"1, 2, 3, access-control, extended-mkcol, calendar-access, addressbook",
|
||||
concat!(
|
||||
"1, 2, 3, access-control, extended-mkcol, ",
|
||||
"calendar-access, calendar-no-timezone, addressbook"
|
||||
),
|
||||
)
|
||||
.with_header(
|
||||
"allow",
|
||||
|
||||
@@ -70,6 +70,28 @@ pub async fn test(test: &WebDavTest) {
|
||||
);
|
||||
client.validate_values(&hierarchy).await;
|
||||
|
||||
// Delete cache an resync
|
||||
test.clear_cache();
|
||||
let response = client
|
||||
.sync_collection(
|
||||
&user_base_path,
|
||||
prev_sync_token,
|
||||
Depth::Infinity,
|
||||
None,
|
||||
["D:getetag"],
|
||||
)
|
||||
.await;
|
||||
let sync_token = response.sync_token();
|
||||
let changed_hrefs = response.hrefs();
|
||||
assert_ne!(sync_token, prev_sync_token);
|
||||
assert_eq!(
|
||||
changed_hrefs,
|
||||
hierarchy.iter().map(|x| x.0.as_str()).collect::<Vec<_>>(),
|
||||
"lengths {} & {}",
|
||||
changed_hrefs.len(),
|
||||
hierarchy.len()
|
||||
);
|
||||
|
||||
// Copying and moving to the same or root containers is invalid
|
||||
for method in ["COPY", "MOVE"] {
|
||||
for destination in [
|
||||
|
||||
@@ -22,6 +22,7 @@ use common::{
|
||||
manager::boot::build_ipc,
|
||||
};
|
||||
use dav_proto::schema::property::{DavProperty, WebDavProperty};
|
||||
use directory::Permission;
|
||||
use groupware::{DavResourceName, cache::GroupwareCache};
|
||||
use http::HttpSessionManager;
|
||||
use hyper::{HeaderMap, Method, StatusCode, header::AUTHORIZATION};
|
||||
@@ -201,6 +202,12 @@ async fn init_webdav_tests(store_id: &str, delete_if_exists: bool) -> WebDavTest
|
||||
*account,
|
||||
DummyWebDavClient::new(account_id, account, secret, email),
|
||||
);
|
||||
store
|
||||
.add_permissions(
|
||||
account,
|
||||
[Permission::DavPrincipalList, Permission::DavPrincipalSearch],
|
||||
)
|
||||
.await;
|
||||
if *account == "mike" {
|
||||
store.set_test_quota(account, 1024).await;
|
||||
}
|
||||
@@ -232,8 +239,7 @@ impl WebDavTest {
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub async fn assert_is_empty(&self) {
|
||||
assert_is_empty(self.server.clone()).await;
|
||||
pub fn clear_cache(&self) {
|
||||
for cache in [
|
||||
&self.server.inner.cache.events,
|
||||
&self.server.inner.cache.contacts,
|
||||
@@ -242,6 +248,11 @@ impl WebDavTest {
|
||||
cache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn assert_is_empty(&self) {
|
||||
assert_is_empty(self.server.clone()).await;
|
||||
self.clear_cache();
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
|
||||
Reference in New Issue
Block a user