-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #238 from sj-distributor/role-permission-function-…
…development Role permission function development
- Loading branch information
Showing
60 changed files
with
4,777 additions
and
1,157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,21 @@ | ||
import { Route, Routes, Navigate } from "react-router-dom" | ||
import { routerArray } from "./router/elementRoute" | ||
import Login from "./pages/login" | ||
import Main from "./pages/main" | ||
import useAction from "./AppHook" | ||
import { RouteItem } from "./dtos/route-type" | ||
import IsAuthUser from "./pages/auth" | ||
import { Router } from "./router/elementRoute"; | ||
import TokenProvider from "./hooks/authProvider"; | ||
import useAction from "./AppHook"; | ||
|
||
const App = () => { | ||
const { isLoaded } = useAction() | ||
|
||
const getSubRoute = (list: RouteItem[]) => { | ||
return list.map((item, index) => { | ||
return ( | ||
<Route | ||
key={index} | ||
path={item.path} | ||
element={<IsAuthUser>{item.element}</IsAuthUser>} | ||
> | ||
<Route path="" element={<Navigate to="/home/enterprise" />} /> | ||
|
||
{item.children?.map((childrenItem, childrenIndex) => { | ||
return ( | ||
<Route | ||
key={childrenIndex} | ||
path={childrenItem.path} | ||
element={childrenItem.elementChild} | ||
/> | ||
) | ||
})} | ||
</Route> | ||
) | ||
}) | ||
} | ||
const { isLoaded } = useAction(); | ||
|
||
return ( | ||
<> | ||
{isLoaded && ( | ||
<div className="App"> | ||
<Routes> | ||
<Route path="/login" element={<Login />} /> | ||
<Route element={<Main />}> | ||
<Route path="" element={<Navigate to={"/home"} />} /> | ||
{getSubRoute(routerArray)} | ||
</Route> | ||
</Routes> | ||
</div> | ||
<TokenProvider> | ||
<div className="App"> | ||
<Router /> | ||
</div> | ||
</TokenProvider> | ||
)} | ||
</> | ||
) | ||
} | ||
); | ||
}; | ||
|
||
export default App | ||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { IEmailResonponse } from "../../dtos/email" | ||
import { Get, Post } from "../http-client" | ||
import { IEmailResonponse } from "../../dtos/email"; | ||
import { Get } from "../http-client"; | ||
|
||
export const GetEmailData = async () => { | ||
return await Get<IEmailResonponse[]>("/api/Email/server/accounts") | ||
} | ||
return await Get<IEmailResonponse[]>("/api/Email/server/accounts"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import { | ||
IAddRoleUsersDto, | ||
IDeleteRole, | ||
IDeleteRoleUserRequest, | ||
IFoundationTreeDto, | ||
IPageDto, | ||
IPermissionsDto, | ||
IRolePermission, | ||
IRolePermissionDto, | ||
IRoleUserItemDto, | ||
IRoleUserPageDto, | ||
IRoleUserResponse, | ||
} from "../../dtos/role-user-permissions"; | ||
import { Get, Post } from "../http-client"; | ||
|
||
export const GetCurrentRolesByPermissions = async () => { | ||
return await Get<IRolePermissionDto>(`/api/Security/mine/roles`); | ||
}; | ||
|
||
// 获取用户list | ||
export const GetRoleUser = async (data: IRoleUserPageDto) => { | ||
return await Get<IRoleUserResponse>( | ||
`/api/Security/role/users?PageIndex=${data.PageIndex + 1}&PageSize=${ | ||
data.PageSize | ||
}&RoleId=${data.RoleId}&Keyword=${data.Keyword}` | ||
); | ||
}; | ||
|
||
// 移除用户 | ||
export const DeleteRoleUser = async (data: IDeleteRoleUserRequest) => { | ||
return await Post("/api/Security/role/users/delete", data); | ||
}; | ||
|
||
// 添加用户 | ||
export const AddRoleUser = async (data: IAddRoleUsersDto) => { | ||
return await Post<IRoleUserItemDto>("/api/Security/role/users/create", data); | ||
}; | ||
|
||
//人员层级tree | ||
export const GetTreeList = async () => { | ||
return await Get<IFoundationTreeDto>( | ||
"/api/Foundation/department/staff/hierarchy/tree" | ||
); | ||
}; | ||
|
||
//获取全部角色用户列表 | ||
export const GetRoleUserList = async () => { | ||
return await Get<IRoleUserResponse>(`/api/Security/role/users`); | ||
}; | ||
|
||
// 获取功能权限 | ||
export const GetPermissions = async () => { | ||
return await Get<IPermissionsDto>("/api/Security/permissions"); | ||
}; | ||
|
||
// 查询角色 | ||
export const GetRolePermission = async (roleId: string) => { | ||
return await Get<IRolePermission>(`/api/Security/role/${roleId}/permissions`); | ||
}; | ||
|
||
// 添加角色 | ||
export const AddRolePermission = async (data: IRolePermission) => { | ||
return await Post<IRolePermission>( | ||
"/api/Security/role/permissions/assign", | ||
data | ||
); | ||
}; | ||
|
||
// 更新角色 | ||
export const UpdateRolePermission = async (data: IRolePermission) => { | ||
return await Post<IRolePermission>( | ||
"/api/Security/role/permissions/edit", | ||
data | ||
); | ||
}; | ||
|
||
// 获取角色list | ||
export const GetRolesByPermissions = async (data: IPageDto) => { | ||
return await Get<IRolePermissionDto>( | ||
`/api/Security/roles/by/permissions?PageIndex=${ | ||
data.pageIndex + 1 | ||
}&PageSize=${data.pageSize}${ | ||
data.keyword ? "&Keyword=" + data.keyword : "" | ||
}` | ||
); | ||
}; | ||
|
||
//删除角色 | ||
export const DeleteRoles = async (data: IDeleteRole) => { | ||
return await Post("/api/Security/roles/delete", data); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,35 @@ | ||
import { ILoginRequest } from "../../dtos/login" | ||
import { ILoginRequest } from "../../dtos/login"; | ||
import { | ||
IGetAllUserDto, | ||
IUserAllResponse, | ||
IUserApikeyAddData, | ||
IUserApikeysResponse, | ||
IUserResponse, | ||
} from "../../dtos/user-management" | ||
import { Get, Post } from "../http-client" | ||
} from "../../dtos/user-management"; | ||
import { Get, Post } from "../http-client"; | ||
|
||
export const GetAuthUser = async () => { | ||
return await Get<IUserResponse>("/auth/user") | ||
} | ||
return await Get<IUserResponse>("/auth/user"); | ||
}; | ||
|
||
export const PostAuthRegister = async (data: ILoginRequest) => { | ||
return await Post("/auth/register", data) | ||
} | ||
return await Post("/auth/register", data); | ||
}; | ||
|
||
export const GetAllUsers = async () => { | ||
return await Get<IUserResponse[]>("/auth/allUsers") | ||
} | ||
export const GetAllUsers = async (data: IGetAllUserDto) => { | ||
return await Get<IUserAllResponse>( | ||
`/auth/allUsers?PageIndex=${data.Page}&PageSize=${data.PageSize}${ | ||
data.UserName ? "&UserName=" + data.UserName : "" | ||
}` | ||
); | ||
}; | ||
|
||
export const GetUserApikeys = async (userId: string) => { | ||
return await Get<IUserApikeysResponse[]>( | ||
`/auth/user/apikeys?UserId=${userId}` | ||
) | ||
} | ||
); | ||
}; | ||
|
||
export const PostUserApikeysAdd = async (data: IUserApikeyAddData) => { | ||
return await Post("/auth/user/apikey/add", data) | ||
} | ||
return await Post("/auth/user/apikey/add", data); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.