Skip to content

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

fix(user_role): Filter out internal roles in list roles API (#9402)

Venu Madhav Bandarupallid7e468f9be4f
diff --git a/crates/router/src/core/user_role/role.rs b/crates/router/src/core/user_role/role.rs
index 25388c1381..697d0213d8 100644
--- a/crates/router/src/core/user_role/role.rs
+++ b/crates/router/src/core/user_role/role.rs
@@ -1,4 +1,4 @@
-use std::{cmp, collections::HashSet};
+use std::{cmp, collections::HashSet, ops::Not};
use api_models::user_role::role as role_api;
use common_enums::{EntityType, ParentGroup, PermissionGroup};
@@ -450,7 +450,11 @@ pub async fn list_roles_with_info(
.into());
}
- let mut role_info_vec = PREDEFINED_ROLES.values().cloned().collect::<Vec<_>>();
+ let mut role_info_vec = PREDEFINED_ROLES
+ .values()
+ .filter(|role| role.is_internal().not())
+ .cloned()
+ .collect::<Vec<_>>();
let user_role_entity = user_role_info.get_entity_type();
let is_lineage_data_required = request.entity_type.is_none();