diff --git a/server/core/src/https/v1_oauth2.rs b/server/core/src/https/v1_oauth2.rs index d3966a7ad..f399539bc 100644 --- a/server/core/src/https/v1_oauth2.rs +++ b/server/core/src/https/v1_oauth2.rs @@ -200,6 +200,7 @@ pub(crate) async fn oauth2_id_scopemap_post( Json(scopes): Json>, ) -> Result, WebError> { let filter = oauth2_id(&rs_name); + state .qe_w_ref .handle_oauth2_scopemap_update(client_auth_info, group, scopes, filter, kopid.eventid) diff --git a/server/lib/src/valueset/oauth.rs b/server/lib/src/valueset/oauth.rs index 7b1ed8d75..0b6ec0f2d 100644 --- a/server/lib/src/valueset/oauth.rs +++ b/server/lib/src/valueset/oauth.rs @@ -279,6 +279,7 @@ impl ValueSetT for ValueSetOauthScopeMap { match value { Value::OauthScopeMap(u, m) => { match self.map.entry(u) { + // We are going to assume that a vacant entry will not be set to empty. BTreeEntry::Vacant(e) => { e.insert(m); Ok(true) @@ -289,7 +290,12 @@ impl ValueSetT for ValueSetOauthScopeMap { // associated map state. So by always replacing on a present, we are true to // the intent of the api. BTreeEntry::Occupied(mut e) => { - e.insert(m); + if m.is_empty() { + e.remove(); + } else { + e.insert(m); + } + Ok(true) } }