fix: add rbac organization tree contracts
This commit is contained in:
@@ -53,6 +53,7 @@ class UserVO(BaseModel):
|
|||||||
roles: list[UserRoleVO] = Field(default_factory=list, description="角色列表")
|
roles: list[UserRoleVO] = Field(default_factory=list, description="角色列表")
|
||||||
tenant_name: str | None = Field(None, description="租户名称")
|
tenant_name: str | None = Field(None, description="租户名称")
|
||||||
dep_name: str | None = Field(None, description="部门名称")
|
dep_name: str | None = Field(None, description="部门名称")
|
||||||
|
dep_short_name: str | None = Field(None, description="部门简称")
|
||||||
|
|
||||||
|
|
||||||
class UserListVO(BaseModel):
|
class UserListVO(BaseModel):
|
||||||
@@ -64,6 +65,53 @@ class UserListVO(BaseModel):
|
|||||||
items: list[UserVO] = Field(default_factory=list, description="用户列表")
|
items: list[UserVO] = Field(default_factory=list, description="用户列表")
|
||||||
|
|
||||||
|
|
||||||
|
class OrganizationPathVO(BaseModel):
|
||||||
|
"""用户组织路径。"""
|
||||||
|
|
||||||
|
tenant_name: str = Field("", description="租户名称")
|
||||||
|
dep_name: str = Field("", description="部门名称")
|
||||||
|
dep_short_name: str = Field("", description="部门简称")
|
||||||
|
ou_name: str = Field("", description="组织名称")
|
||||||
|
|
||||||
|
|
||||||
|
class OrganizationTreeUserVO(BaseModel):
|
||||||
|
"""组织树节点中的用户。"""
|
||||||
|
|
||||||
|
id: int = Field(..., description="用户ID")
|
||||||
|
username: str = Field(..., description="用户名")
|
||||||
|
nick_name: str = Field(..., description="姓名")
|
||||||
|
area: str | None = Field(None, description="地区")
|
||||||
|
ou_id: str = Field("", description="组织ID")
|
||||||
|
ou_name: str = Field("", description="组织名称")
|
||||||
|
is_leader: bool = Field(False, description="是否负责人")
|
||||||
|
status: int = Field(0, description="状态")
|
||||||
|
tenant_name: str | None = Field(None, description="租户名称")
|
||||||
|
dep_name: str | None = Field(None, description="部门名称")
|
||||||
|
dep_short_name: str | None = Field(None, description="部门简称")
|
||||||
|
email: str | None = Field(None, description="邮箱")
|
||||||
|
phone_number: str | None = Field(None, description="手机号")
|
||||||
|
organization_path: OrganizationPathVO | None = Field(None, description="组织路径")
|
||||||
|
|
||||||
|
|
||||||
|
class OrganizationNodeVO(BaseModel):
|
||||||
|
"""组织树节点。"""
|
||||||
|
|
||||||
|
ou_id: str = Field(..., description="节点ID")
|
||||||
|
ou_name: str = Field(..., description="节点名称")
|
||||||
|
parent_ou_id: str | None = Field(None, description="父节点ID")
|
||||||
|
level: int = Field(1, description="层级")
|
||||||
|
children: list["OrganizationNodeVO"] = Field(default_factory=list, description="子节点")
|
||||||
|
users: list[OrganizationTreeUserVO] = Field(default_factory=list, description="节点用户")
|
||||||
|
|
||||||
|
|
||||||
|
class OrganizationTreeVO(BaseModel):
|
||||||
|
"""组织树响应。"""
|
||||||
|
|
||||||
|
organizations: list[OrganizationNodeVO] = Field(default_factory=list, description="组织树")
|
||||||
|
total_organizations: int = Field(0, description="组织节点总数")
|
||||||
|
total_users: int = Field(0, description="用户总数")
|
||||||
|
|
||||||
|
|
||||||
class RoutePermissionVO(BaseModel):
|
class RoutePermissionVO(BaseModel):
|
||||||
"""路由关联的 API 权限。"""
|
"""路由关联的 API 权限。"""
|
||||||
|
|
||||||
@@ -157,3 +205,4 @@ class RoutePermissionsVO(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
RouteVO.model_rebuild()
|
RouteVO.model_rebuild()
|
||||||
|
OrganizationNodeVO.model_rebuild()
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from fastapi_modules.fastapi_leaudit.domian.Dto.rbacAdminDto import (
|
|||||||
RoleUpdateDTO,
|
RoleUpdateDTO,
|
||||||
)
|
)
|
||||||
from fastapi_modules.fastapi_leaudit.domian.vo.rbacAdminVo import (
|
from fastapi_modules.fastapi_leaudit.domian.vo.rbacAdminVo import (
|
||||||
|
OrganizationTreeVO,
|
||||||
RoleAccessSaveVO,
|
RoleAccessSaveVO,
|
||||||
RoleListVO,
|
RoleListVO,
|
||||||
RolePermissionsVO,
|
RolePermissionsVO,
|
||||||
@@ -51,6 +52,11 @@ class IRbacAdminService(ABC):
|
|||||||
"""查询用户列表。"""
|
"""查询用户列表。"""
|
||||||
...
|
...
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
async def GetOrganizationTree(self, CurrentUserId: int, IncludeUsers: bool, RootUuid: str | None) -> OrganizationTreeVO:
|
||||||
|
"""查询组织树。"""
|
||||||
|
...
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
async def ListRoleUsers(self, CurrentUserId: int, RoleId: int, Page: int, PageSize: int, Area: str | None, UserName: str | None) -> UserListVO:
|
async def ListRoleUsers(self, CurrentUserId: int, RoleId: int, Page: int, PageSize: int, Area: str | None, UserName: str | None) -> UserListVO:
|
||||||
"""查询指定角色下的用户列表。"""
|
"""查询指定角色下的用户列表。"""
|
||||||
|
|||||||
Reference in New Issue
Block a user