fix(lint) minor lint fix for unnecessary match use (#3118)

sorry clippy I'm a better lintyboi naow
This commit is contained in:
James Hodgkinson 2024-10-18 09:27:49 +10:00 committed by GitHub
parent 9836b2bf12
commit b96eceb205
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -871,80 +871,75 @@ pub async fn create_server_core(
}; };
// Any pre-start tasks here. // Any pre-start tasks here.
match &config.integration_test_config { if let Some(itc) = &config.integration_test_config {
Some(itc) => { let Ok(mut idms_prox_write) = idms.proxy_write(duration_from_epoch_now()).await else {
let Ok(mut idms_prox_write) = idms.proxy_write(duration_from_epoch_now()).await else { error!("Unable to acquire write transaction");
error!("Unable to acquire write transaction"); return Err(());
};
// We need to set the admin pw.
match idms_prox_write.recover_account(&itc.admin_user, Some(&itc.admin_password)) {
Ok(_) => {}
Err(e) => {
error!(
"Unable to configure INTEGRATION TEST {} account -> {:?}",
&itc.admin_user, e
);
return Err(()); return Err(());
}; }
// We need to set the admin pw. };
match idms_prox_write.recover_account(&itc.admin_user, Some(&itc.admin_password)) { // set the idm_admin account password
Ok(_) => {} match idms_prox_write.recover_account(&itc.idm_admin_user, Some(&itc.idm_admin_password)) {
Err(e) => { Ok(_) => {}
error!( Err(e) => {
"Unable to configure INTEGRATION TEST {} account -> {:?}", error!(
&itc.admin_user, e "Unable to configure INTEGRATION TEST {} account -> {:?}",
); &itc.idm_admin_user, e
return Err(()); );
} return Err(());
}; }
// set the idm_admin account password };
match idms_prox_write
.recover_account(&itc.idm_admin_user, Some(&itc.idm_admin_password))
{
Ok(_) => {}
Err(e) => {
error!(
"Unable to configure INTEGRATION TEST {} account -> {:?}",
&itc.idm_admin_user, e
);
return Err(());
}
};
// Add admin to idm_admins to allow tests more flexibility wrt to permissions. // Add admin to idm_admins to allow tests more flexibility wrt to permissions.
// This way our default access controls can be stricter to prevent lateral // This way our default access controls can be stricter to prevent lateral
// movement. // movement.
match idms_prox_write.qs_write.internal_modify_uuid( match idms_prox_write.qs_write.internal_modify_uuid(
UUID_IDM_ADMINS, UUID_IDM_ADMINS,
&ModifyList::new_append(Attribute::Member, Value::Refer(UUID_ADMIN)), &ModifyList::new_append(Attribute::Member, Value::Refer(UUID_ADMIN)),
) { ) {
Ok(_) => {} Ok(_) => {}
Err(e) => { Err(e) => {
error!( error!(
"Unable to configure INTEGRATION TEST admin as member of idm_admins -> {:?}", "Unable to configure INTEGRATION TEST admin as member of idm_admins -> {:?}",
e e
); );
return Err(()); return Err(());
} }
}; };
match idms_prox_write.qs_write.internal_modify_uuid( match idms_prox_write.qs_write.internal_modify_uuid(
UUID_IDM_ALL_PERSONS, UUID_IDM_ALL_PERSONS,
&ModifyList::new_purge_and_set( &ModifyList::new_purge_and_set(
Attribute::CredentialTypeMinimum, Attribute::CredentialTypeMinimum,
CredentialType::Any.into(), CredentialType::Any.into(),
), ),
) { ) {
Ok(_) => {} Ok(_) => {}
Err(e) => { Err(e) => {
error!( error!(
"Unable to configure INTEGRATION TEST default credential policy -> {:?}", "Unable to configure INTEGRATION TEST default credential policy -> {:?}",
e e
); );
return Err(()); return Err(());
} }
}; };
match idms_prox_write.commit() { match idms_prox_write.commit() {
Ok(_) => {} Ok(_) => {}
Err(e) => { Err(e) => {
error!("Unable to commit INTEGRATION TEST setup -> {:?}", e); error!("Unable to commit INTEGRATION TEST setup -> {:?}", e);
return Err(()); return Err(());
}
} }
} }
None => {}
} }
let ldap = match LdapServer::new(&idms).await { let ldap = match LdapServer::new(&idms).await {