From be988eb1453020804320123fee000edaf3bad03e Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 7 Nov 2026 22:35:10 +0100 Subject: access: no manages flag GET /admin/users no longer lists a manages flag per user: whether a user may manage users follows from its capabilities. Auth plan M1 (cleanup). --- src/api/users.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/api/users.rs') diff --git a/src/api/users.rs b/src/api/users.rs index 7c65eb5..1d01af7 100644 --- a/src/api/users.rs +++ b/src/api/users.rs @@ -1,7 +1,7 @@ //! `/admin/users`: the swarm's users and what each may do (`access.md`), managed //! through the API rather than by writing the registry's entries through the store. //! -//! * `GET /admin/users`: every user, its entry and whether it may manage users. +//! * `GET /admin/users`: every user and its entry. //! * `GET /admin/users/{name}`: one. //! * `POST /admin/users/{name}`: adds a user, with the capabilities of the body //! (`{"caps": [{"path": [...], "rights": ["read", "write"]}, …]}`, none if absent); @@ -119,13 +119,11 @@ fn may_manage(state: &AppState, user: &str, access: &Access) -> Result<(), ApiEr } } -/// A user's entry as the API shows it: as recorded, and whether it may manage users. +/// A user's entry as the API shows it: as recorded, with its name. fn shown(doc: &impl crate::document::ReadDoc, name: &str) -> Option { let mut entry = store::read_path(doc, ®istry::user_path(name)).ok()??; - let manages = registry::caps_of(doc, name).allows(Right::Write, ®istry::users_dir()); if let Some(object) = entry.as_object_mut() { object.insert("name".to_owned(), json!(name)); - object.insert("manages".to_owned(), json!(manages)); } Some(entry) } -- cgit v1.3.1