feat: add profile_id authentication for business profile update and list (#5673)

This commit is contained in:
Hrithikesh
2024-09-03 11:37:06 +05:30
committed by GitHub
parent f822730979
commit e3a9fb16c5
7 changed files with 148 additions and 10 deletions

View File

@ -1334,7 +1334,7 @@ pub fn get_incremental_authorization_allowed_value(
}
}
pub(super) trait GetProfileId {
pub(crate) trait GetProfileId {
fn get_profile_id(&self) -> Option<&common_utils::id_type::ProfileId>;
}
@ -1381,6 +1381,12 @@ impl<T, F> GetProfileId for (storage::Payouts, T, F) {
}
}
impl GetProfileId for domain::BusinessProfile {
fn get_profile_id(&self) -> Option<&common_utils::id_type::ProfileId> {
Some(self.get_id())
}
}
/// Filter Objects based on profile ids
pub(super) fn filter_objects_based_on_profile_id_list<T: GetProfileId>(
profile_id_list_auth_layer: Option<Vec<common_utils::id_type::ProfileId>>,
@ -1406,7 +1412,7 @@ pub(super) fn filter_objects_based_on_profile_id_list<T: GetProfileId>(
}
}
pub(super) fn validate_profile_id_from_auth_layer<T: GetProfileId + std::fmt::Debug>(
pub(crate) fn validate_profile_id_from_auth_layer<T: GetProfileId + std::fmt::Debug>(
profile_id_auth_layer: Option<common_utils::id_type::ProfileId>,
object: &T,
) -> RouterResult<()> {