mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 21:07:58 +08:00
feat(user_roles): support switch for new hierarchy (#5692)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -108,16 +108,16 @@ pub async fn generate_jwt_auth_token_without_profile(
|
||||
Ok(Secret::new(token))
|
||||
}
|
||||
|
||||
pub async fn generate_jwt_auth_token_with_custom_role_attributes(
|
||||
pub async fn generate_jwt_auth_token_with_attributes(
|
||||
state: &SessionState,
|
||||
user: &UserFromStorage,
|
||||
user_id: String,
|
||||
merchant_id: id_type::MerchantId,
|
||||
org_id: id_type::OrganizationId,
|
||||
role_id: String,
|
||||
profile_id: Option<id_type::ProfileId>,
|
||||
) -> UserResult<Secret<String>> {
|
||||
let token = AuthToken::new_token(
|
||||
user.get_user_id().to_string(),
|
||||
user_id,
|
||||
merchant_id,
|
||||
role_id,
|
||||
&state.conf,
|
||||
|
||||
@ -128,6 +128,18 @@ pub async fn set_role_permissions_in_cache_by_user_role(
|
||||
.is_ok()
|
||||
}
|
||||
|
||||
pub async fn set_role_permissions_in_cache_by_role_id_merchant_id_org_id(
|
||||
state: &SessionState,
|
||||
role_id: &str,
|
||||
merchant_id: &id_type::MerchantId,
|
||||
org_id: &id_type::OrganizationId,
|
||||
) -> bool {
|
||||
set_role_permissions_in_cache_if_required(state, role_id, merchant_id, org_id)
|
||||
.await
|
||||
.map_err(|e| logger::error!("Error setting permissions in cache {:?}", e))
|
||||
.is_ok()
|
||||
}
|
||||
|
||||
pub async fn set_role_permissions_in_cache_if_required(
|
||||
state: &SessionState,
|
||||
role_id: &str,
|
||||
|
||||
Reference in New Issue
Block a user