mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 21:07:58 +08:00
feat(users): add global support in user roles (#6458)
This commit is contained in:
@ -92,6 +92,7 @@ pub async fn generate_jwt_auth_token_with_attributes(
|
||||
org_id: id_type::OrganizationId,
|
||||
role_id: String,
|
||||
profile_id: id_type::ProfileId,
|
||||
tenant_id: Option<String>,
|
||||
) -> UserResult<Secret<String>> {
|
||||
let token = AuthToken::new_token(
|
||||
user_id,
|
||||
@ -100,6 +101,7 @@ pub async fn generate_jwt_auth_token_with_attributes(
|
||||
&state.conf,
|
||||
org_id,
|
||||
Some(profile_id),
|
||||
tenant_id,
|
||||
)
|
||||
.await?;
|
||||
Ok(Secret::new(token))
|
||||
|
||||
@ -142,7 +142,7 @@ pub async fn update_v1_and_v2_user_roles_in_db(
|
||||
Result<UserRole, Report<StorageError>>,
|
||||
) {
|
||||
let updated_v1_role = state
|
||||
.store
|
||||
.global_store
|
||||
.update_user_role_by_user_id_and_lineage(
|
||||
user_id,
|
||||
org_id,
|
||||
@ -158,7 +158,7 @@ pub async fn update_v1_and_v2_user_roles_in_db(
|
||||
});
|
||||
|
||||
let updated_v2_role = state
|
||||
.store
|
||||
.global_store
|
||||
.update_user_role_by_user_id_and_lineage(
|
||||
user_id,
|
||||
org_id,
|
||||
@ -228,7 +228,7 @@ pub async fn get_lineage_for_user_id_and_entity_for_accepting_invite(
|
||||
};
|
||||
|
||||
let user_roles = state
|
||||
.store
|
||||
.global_store
|
||||
.list_user_roles_by_user_id(ListUserRolesByUserIdPayload {
|
||||
user_id,
|
||||
org_id: Some(&org_id),
|
||||
@ -272,7 +272,7 @@ pub async fn get_lineage_for_user_id_and_entity_for_accepting_invite(
|
||||
};
|
||||
|
||||
let user_roles = state
|
||||
.store
|
||||
.global_store
|
||||
.list_user_roles_by_user_id(ListUserRolesByUserIdPayload {
|
||||
user_id,
|
||||
org_id: None,
|
||||
@ -317,7 +317,7 @@ pub async fn get_lineage_for_user_id_and_entity_for_accepting_invite(
|
||||
};
|
||||
|
||||
let user_roles = state
|
||||
.store
|
||||
.global_store
|
||||
.list_user_roles_by_user_id(ListUserRolesByUserIdPayload {
|
||||
user_id,
|
||||
org_id: None,
|
||||
@ -407,7 +407,7 @@ pub async fn fetch_user_roles_by_payload(
|
||||
request_entity_type: Option<EntityType>,
|
||||
) -> UserResult<HashSet<UserRole>> {
|
||||
Ok(state
|
||||
.store
|
||||
.global_store
|
||||
.list_user_roles_by_org_id(payload)
|
||||
.await
|
||||
.change_context(UserErrors::InternalServerError)?
|
||||
|
||||
Reference in New Issue
Block a user