mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 04:27:02 +01:00
chore: Remove empty scopemaps (#3170)
This commit is contained in:
parent
7a9bb9eac2
commit
f68906bf1b
|
@ -200,6 +200,7 @@ pub(crate) async fn oauth2_id_scopemap_post(
|
|||
Json(scopes): Json<Vec<String>>,
|
||||
) -> Result<Json<()>, WebError> {
|
||||
let filter = oauth2_id(&rs_name);
|
||||
|
||||
state
|
||||
.qe_w_ref
|
||||
.handle_oauth2_scopemap_update(client_auth_info, group, scopes, filter, kopid.eventid)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue