1
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-08-02 17:19:10 +00:00

Remove OrganizationId guard from get_master_password_policy

This commit is contained in:
Timshel 2025-01-10 17:38:14 +01:00
commit 2f4d2daec6
2 changed files with 9 additions and 4 deletions

View file

@ -1880,15 +1880,20 @@ async fn list_policies_token(org_id: OrganizationId, token: &str, mut conn: DbCo
} }
// Called during the SSO enrollment. // Called during the SSO enrollment.
// Cannot use the OrganizationId guard since the Org does not exists.
#[get("/organizations/<org_id>/policies/master-password", rank = 1)] #[get("/organizations/<org_id>/policies/master-password", rank = 1)]
fn get_master_password_policy(org_id: OrganizationId, _headers: Headers) -> JsonResult { fn get_master_password_policy(org_id: &str, _headers: Headers) -> JsonResult {
let data = match CONFIG.sso_master_password_policy() { let data = match CONFIG.sso_master_password_policy() {
Some(policy) => policy, Some(policy) => policy,
None => "null".to_string(), None => "null".to_string(),
}; };
let policy = let policy = OrgPolicy::new(
OrgPolicy::new(org_id, OrgPolicyType::MasterPassword, CONFIG.sso_master_password_policy().is_some(), data); OrganizationId(org_id.to_string()),
OrgPolicyType::MasterPassword,
CONFIG.sso_master_password_policy().is_some(),
data,
);
Ok(Json(policy.to_json())) Ok(Json(policy.to_json()))
} }

View file

@ -1156,7 +1156,7 @@ impl OrganizationApiKey {
)] )]
#[deref(forward)] #[deref(forward)]
#[from(forward)] #[from(forward)]
pub struct OrganizationId(String); pub struct OrganizationId(pub String);
#[derive( #[derive(
Clone, Clone,