aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/users.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/users.rs')
-rw-r--r--src/api/users.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/api/users.rs b/src/api/users.rs
index cf28ed1..0c41a56 100644
--- a/src/api/users.rs
+++ b/src/api/users.rs
@@ -132,7 +132,7 @@ fn may_manage(state: &AppState, user: &str, access: &Access) -> Result<(), ApiEr
}
/// A user's entry as the API shows it: as recorded, with its name.
-fn shown(doc: &impl crate::document::ReadDoc, name: &str) -> Option<JsonValue> {
+fn shown(doc: &(impl crate::document::view::Read + ?Sized), name: &str) -> Option<JsonValue> {
let mut entry = view::read_plain(doc, &registry::user_path(name)).ok()??;
if let Some(object) = entry.as_object_mut() {
object.insert("name".to_owned(), json!(name));
@@ -207,7 +207,7 @@ async fn own_key(
let adding = line.is_some();
let id_kept = id.clone();
state
- .mutate_doc_for(Some(user.to_owned()), Sign::Protocol, move |doc| {
+ .mutate_doc_by(Some(user.to_owned()), Sign::Protocol, move |doc| {
if crate::access::policy::of(&*doc).strict() {
return Err(ApiError(
StatusCode::CONFLICT,
@@ -287,7 +287,7 @@ async fn change(
state: &AppState,
user: &str,
what: String,
- f: impl FnOnce(&mut crate::document::Transaction<'_>, &str, u64) -> Result<(), ApiError>
+ f: impl FnOnce(&mut dyn crate::document::view::Write, &str, u64) -> Result<(), ApiError>
+ Send
+ 'static,
) -> Result<(), ApiError> {
@@ -298,7 +298,7 @@ async fn change(
let writer = user.to_owned();
let since = state.clock.now_millis().as_u64();
state
- .mutate_doc_for(Some(user.to_owned()), Sign::Protocol, move |doc| {
+ .mutate_doc_by(Some(user.to_owned()), Sign::Protocol, move |doc| {
if crate::access::policy::of(&*doc).strict() {
return Err(ApiError(
StatusCode::CONFLICT,