Skip to content

Commit

Permalink
config: backward compatibility with legacy princs filter
Browse files Browse the repository at this point in the history
Case-sensitive by default in case "princs" is used.
  • Loading branch information
MrAnno committed Dec 13, 2024
1 parent e703038 commit b7c61b4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion common/src/models/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,22 @@ struct ClientFilter {
pub kind: crate::subscription::ClientFilterType,
#[serde(default)]
pub flags: crate::subscription::ClientFilterFlags,
#[serde(alias = "cert_subjects", alias = "princs")]
#[serde(default)]
pub targets: HashSet<String>,

#[deprecated(since = "0.4.0", note = "Only for backward compatibility. Use targets instead")]
pub princs: Option<HashSet<String>>,
}

impl TryFrom<ClientFilter> for crate::subscription::ClientFilter {
type Error = anyhow::Error;

fn try_from(value: ClientFilter) -> std::prelude::v1::Result<Self, Self::Error> {
#[allow(deprecated)]
if let Some(princs) = value.princs {
return Ok(crate::subscription::ClientFilter::new_legacy(value.operation.into(), princs));
}

crate::subscription::ClientFilter::try_new(value.operation.into(), value.kind, value.flags, value.targets)
}
}
Expand Down

0 comments on commit b7c61b4

Please sign in to comment.