mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 05:17:02 +08:00
refactor(user_roles): Populate role names and entity names in user role APIs (#5861)
This commit is contained in:
@ -75,9 +75,14 @@ impl UserFromToken {
|
||||
}
|
||||
|
||||
pub async fn get_role_info_from_db(&self, state: &SessionState) -> UserResult<RoleInfo> {
|
||||
RoleInfo::from_role_id(state, &self.role_id, &self.merchant_id, &self.org_id)
|
||||
.await
|
||||
.change_context(UserErrors::InternalServerError)
|
||||
RoleInfo::from_role_id_in_merchant_scope(
|
||||
state,
|
||||
&self.role_id,
|
||||
&self.merchant_id,
|
||||
&self.org_id,
|
||||
)
|
||||
.await
|
||||
.change_context(UserErrors::InternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -152,10 +152,11 @@ pub async fn set_role_permissions_in_cache_if_required(
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let role_info = roles::RoleInfo::from_role_id(state, role_id, merchant_id, org_id)
|
||||
.await
|
||||
.change_context(UserErrors::InternalServerError)
|
||||
.attach_printable("Error getting role_info from role_id")?;
|
||||
let role_info =
|
||||
roles::RoleInfo::from_role_id_in_merchant_scope(state, role_id, merchant_id, org_id)
|
||||
.await
|
||||
.change_context(UserErrors::InternalServerError)
|
||||
.attach_printable("Error getting role_info from role_id")?;
|
||||
|
||||
authz::set_role_info_in_cache(
|
||||
state,
|
||||
|
||||
Reference in New Issue
Block a user