Skip to content

Commit

Permalink
Remove OrganizationId guard from get_master_password_policy
Browse files Browse the repository at this point in the history
  • Loading branch information
Timshel committed Jan 10, 2025
1 parent 6129214 commit 2f4d2da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/api/core/organizations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1880,15 +1880,20 @@ async fn list_policies_token(org_id: OrganizationId, token: &str, mut conn: DbCo
}

// 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)]
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() {
Some(policy) => policy,
None => "null".to_string(),
};

let policy =
OrgPolicy::new(org_id, OrgPolicyType::MasterPassword, CONFIG.sso_master_password_policy().is_some(), data);
let policy = OrgPolicy::new(
OrganizationId(org_id.to_string()),
OrgPolicyType::MasterPassword,
CONFIG.sso_master_password_policy().is_some(),
data,
);

Ok(Json(policy.to_json()))
}
Expand Down
2 changes: 1 addition & 1 deletion src/db/models/organization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ impl OrganizationApiKey {
)]
#[deref(forward)]
#[from(forward)]
pub struct OrganizationId(String);
pub struct OrganizationId(pub String);

#[derive(
Clone,
Expand Down

0 comments on commit 2f4d2da

Please sign in to comment.