mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-31 01:57:45 +08:00
refactor(user_roles): implement parent group info based role APIs (#8896)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -10,6 +10,14 @@ pub struct CreateRoleRequest {
|
||||
pub entity_type: Option<EntityType>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub struct CreateRoleV2Request {
|
||||
pub role_name: String,
|
||||
pub role_scope: RoleScope,
|
||||
pub entity_type: Option<EntityType>,
|
||||
pub parent_groups: Vec<ParentGroupInfoRequest>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub struct UpdateRoleRequest {
|
||||
pub groups: Option<Vec<PermissionGroup>>,
|
||||
@ -41,8 +49,15 @@ pub struct ParentGroupInfo {
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub struct ListRolesRequest {
|
||||
pub struct ParentGroupInfoRequest {
|
||||
pub name: ParentGroup,
|
||||
pub scopes: Vec<PermissionScope>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub struct ListRolesQueryParams {
|
||||
pub entity_type: Option<EntityType>,
|
||||
pub groups: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize)]
|
||||
@ -54,6 +69,15 @@ pub struct RoleInfoResponseNew {
|
||||
pub scope: RoleScope,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize)]
|
||||
pub struct RoleInfoResponseWithParentsGroup {
|
||||
pub role_id: String,
|
||||
pub role_name: String,
|
||||
pub entity_type: EntityType,
|
||||
pub parent_groups: Vec<ParentGroupInfo>,
|
||||
pub role_scope: RoleScope,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub struct GetRoleRequest {
|
||||
pub role_id: String,
|
||||
@ -64,6 +88,11 @@ pub struct ListRolesAtEntityLevelRequest {
|
||||
pub entity_type: EntityType,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub struct GetParentGroupsInfoQueryParams {
|
||||
pub entity_type: Option<EntityType>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub enum RoleCheckType {
|
||||
Invite,
|
||||
@ -81,3 +110,10 @@ pub struct GroupsAndResources {
|
||||
pub groups: Vec<PermissionGroup>,
|
||||
pub resources: Vec<Resource>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ListRolesResponse {
|
||||
WithGroups(Vec<RoleInfoResponseNew>),
|
||||
WithParentGroups(Vec<RoleInfoResponseWithParentsGroup>),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user