Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
refactor(users): change list roles api to also send inactive merchants (#3583)
Mani Chandracef1643af54f
diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rsindex 41a407bd67..70c3eb6673 100644--- a/crates/router/src/core/user.rs+++ b/crates/router/src/core/user.rs@@ -945,10 +945,13 @@ pub async fn create_merchant_account(pub async fn list_merchant_ids_for_user(state: AppState,- user: auth::UserFromToken,+ user_from_token: auth::UserFromToken,) -> UserResponse<Vec<user_api::UserMerchantAccount>> {- let user_roles =- utils::user_role::get_active_user_roles_for_user(&state, &user.user_id).await?;+ let user_roles = state+ .store+ .list_user_roles_by_user_id(user_from_token.user_id.as_str())+ .await+ .change_context(UserErrors::InternalServerError)?;let merchant_accounts = state.storediff --git a/crates/router/src/utils/user_role.rs b/crates/router/src/utils/user_role.rsindex 7ca06aeda0..462d3d01d7 100644--- a/crates/router/src/utils/user_role.rs+++ b/crates/router/src/utils/user_role.rs@@ -1,11 +1,8 @@use api_models::user_role as user_role_api;-use diesel_models::{enums::UserStatus, user_role::UserRole};-use error_stack::ResultExt;use crate::{consts,core::errors::{UserErrors, UserResult},- routes::AppState,services::authorization::{permissions::Permission,predefined_permissions::{self, RoleInfo},@@ -17,20 +14,6 @@ pub fn is_internal_role(role_id: &str) -> bool {|| role_id == consts::user_role::ROLE_ID_INTERNAL_VIEW_ONLY_USER}-pub async fn get_active_user_roles_for_user(- state: &AppState,- user_id: &str,-) -> UserResult<Vec<UserRole>> {- Ok(state- .store- .list_user_roles_by_user_id(user_id)- .await- .change_context(UserErrors::InternalServerError)?- .into_iter()- .filter(|ele| ele.status == UserStatus::Active)- .collect())-}-pub fn validate_role_id(role_id: &str) -> UserResult<()> {if predefined_permissions::is_role_invitable(role_id) {return Ok(());