fix(users): remove internal entity type for users (#6013)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Apoorv Dixit
2024-09-26 19:32:21 +05:30
committed by GitHub
parent e0a33f8c20
commit 991ca38b50
10 changed files with 179 additions and 245 deletions

View File

@ -239,10 +239,7 @@ pub async fn get_single_merchant_id(
.attach_printable("No merchants found for org_id")?
.get_id()
.clone()),
Some(EntityType::Merchant)
| Some(EntityType::Internal)
| Some(EntityType::Profile)
| None => user_role
Some(EntityType::Merchant) | Some(EntityType::Profile) | None => user_role
.merchant_id
.clone()
.ok_or(UserErrors::InternalServerError)
@ -263,9 +260,7 @@ pub async fn get_lineage_for_user_id_and_entity_for_accepting_invite(
)>,
> {
match entity_type {
EntityType::Internal | EntityType::Organization => {
Err(UserErrors::InvalidRoleOperation.into())
}
EntityType::Organization => Err(UserErrors::InvalidRoleOperation.into()),
EntityType::Merchant => {
let Ok(merchant_id) = id_type::MerchantId::wrap(entity_id) else {
return Ok(None);
@ -369,7 +364,7 @@ pub async fn get_single_merchant_id_and_profile_id(
.get_entity_id_and_type()
.ok_or(UserErrors::InternalServerError)?;
let profile_id = match entity_type {
EntityType::Organization | EntityType::Merchant | EntityType::Internal => {
EntityType::Organization | EntityType::Merchant => {
let key_store = state
.store
.get_merchant_key_store_by_merchant_id(
@ -438,14 +433,6 @@ pub fn get_min_entity(
| (EntityType::Merchant, Some(EntityType::Profile))
| (EntityType::Profile, Some(EntityType::Profile)) => Ok(EntityType::Profile),
(EntityType::Internal, _) => Ok(EntityType::Internal),
(EntityType::Organization, Some(EntityType::Internal))
| (EntityType::Merchant, Some(EntityType::Internal))
| (EntityType::Profile, Some(EntityType::Internal)) => {
Err(UserErrors::InvalidRoleOperation.into())
}
(EntityType::Merchant, Some(EntityType::Organization))
| (EntityType::Profile, Some(EntityType::Organization))
| (EntityType::Profile, Some(EntityType::Merchant)) => {