committed by
GitHub
40 changed files with 3079 additions and 2765 deletions
@ -1,85 +0,0 @@ |
|||
import type { ListResultDto, PagedResultDto } from '@abp/core'; |
|||
|
|||
import type { |
|||
GetIdentityClaimTypePagedListInput, |
|||
IdentityClaimTypeCreateDto, |
|||
IdentityClaimTypeDto, |
|||
IdentityClaimTypeUpdateDto, |
|||
} from '../types/claim-types'; |
|||
|
|||
import { requestClient } from '@abp/request'; |
|||
|
|||
/** |
|||
* 新增用户声明 |
|||
* @param input 参数 |
|||
* @returns 用户声明实体数据传输对象 |
|||
*/ |
|||
export function createApi( |
|||
input: IdentityClaimTypeCreateDto, |
|||
): Promise<IdentityClaimTypeDto> { |
|||
return requestClient.post<IdentityClaimTypeDto>( |
|||
'/api/identity/claim-types', |
|||
input, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 删除用户声明 |
|||
* @param id 用户声明id |
|||
*/ |
|||
export function deleteApi(id: string): Promise<void> { |
|||
return requestClient.delete(`/api/identity/claim-types/${id}`); |
|||
} |
|||
|
|||
/** |
|||
* 查询用户声明 |
|||
* @param id 用户声明id |
|||
* @returns 用户声明实体数据传输对象 |
|||
*/ |
|||
export function getApi(id: string): Promise<IdentityClaimTypeDto> { |
|||
return requestClient.get<IdentityClaimTypeDto>( |
|||
`/api/identity/claim-types/${id}`, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 更新用户声明 |
|||
* @param id 用户声明id |
|||
* @returns 用户声明实体数据传输对象 |
|||
*/ |
|||
export function updateApi( |
|||
id: string, |
|||
input: IdentityClaimTypeUpdateDto, |
|||
): Promise<IdentityClaimTypeDto> { |
|||
return requestClient.put<IdentityClaimTypeDto>( |
|||
`/api/identity/claim-types/${id}`, |
|||
input, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 查询用户声明分页列表 |
|||
* @param input 过滤参数 |
|||
* @returns 用户声明实体数据传输对象分页列表 |
|||
*/ |
|||
export function getPagedListApi( |
|||
input?: GetIdentityClaimTypePagedListInput, |
|||
): Promise<PagedResultDto<IdentityClaimTypeDto>> { |
|||
return requestClient.get<PagedResultDto<IdentityClaimTypeDto>>( |
|||
`/api/identity/claim-types`, |
|||
{ |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 获取可用的声明类型列表 |
|||
*/ |
|||
export function getAssignableClaimsApi(): Promise< |
|||
ListResultDto<IdentityClaimTypeDto> |
|||
> { |
|||
return requestClient.get<ListResultDto<IdentityClaimTypeDto>>( |
|||
`/api/identity/claim-types/actived-list`, |
|||
); |
|||
} |
|||
@ -1,6 +1,6 @@ |
|||
export * as claimTypesApi from './claim-types'; |
|||
export * as organizationUnitsApi from './organization-units'; |
|||
export * as rolesApi from './roles'; |
|||
export * as securityLogsApi from './security-logs'; |
|||
export * as usersApi from './users'; |
|||
export * as userLookupApi from './users-lookup'; |
|||
export * as useClaimTypesApi from './useClaimTypesApi'; |
|||
export * as useOrganizationUnitsApi from './useOrganizationUnitsApi'; |
|||
export * as useRolesApi from './useRolesApi'; |
|||
export * as useSecurityLogsApi from './useSecurityLogsApi'; |
|||
export * as useUserLookup from './useUserLookup'; |
|||
export * as useUsersApi from './useUsersApi'; |
|||
|
|||
@ -1,227 +0,0 @@ |
|||
import type { ListResultDto, PagedResultDto } from '@abp/core'; |
|||
|
|||
import type { IdentityRoleDto, IdentityUserDto } from '../types'; |
|||
import type { |
|||
GetIdentityRolesInput, |
|||
GetIdentityUsersInput, |
|||
GetOrganizationUnitPagedListInput, |
|||
GetUnaddedRoleListInput, |
|||
GetUnaddedUserListInput, |
|||
OrganizationUnitAddRoleDto, |
|||
OrganizationUnitAddUserDto, |
|||
OrganizationUnitCreateDto, |
|||
OrganizationUnitDto, |
|||
OrganizationUnitGetChildrenDto, |
|||
OrganizationUnitUpdateDto, |
|||
} from '../types/organization-units'; |
|||
|
|||
import { requestClient } from '@abp/request'; |
|||
|
|||
/** |
|||
* 新增组织机构 |
|||
* @param input 参数 |
|||
* @returns 组织机构实体数据传输对象 |
|||
*/ |
|||
export function createApi( |
|||
input: OrganizationUnitCreateDto, |
|||
): Promise<OrganizationUnitDto> { |
|||
return requestClient.post<OrganizationUnitDto>( |
|||
'/api/identity/organization-units', |
|||
input, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 删除组织机构 |
|||
* @param id 组织机构id |
|||
*/ |
|||
export function deleteApi(id: string): Promise<void> { |
|||
return requestClient.delete(`/api/identity/organization-units/${id}`); |
|||
} |
|||
|
|||
/** |
|||
* 查询组织机构 |
|||
* @param id 组织机构id |
|||
* @returns 组织机构实体数据传输对象 |
|||
*/ |
|||
export function getApi(id: string): Promise<OrganizationUnitDto> { |
|||
return requestClient.get<OrganizationUnitDto>( |
|||
`/api/identity/organization-units/${id}`, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 更新组织机构 |
|||
* @param id 组织机构id |
|||
* @returns 组织机构实体数据传输对象 |
|||
*/ |
|||
export function updateApi( |
|||
id: string, |
|||
input: OrganizationUnitUpdateDto, |
|||
): Promise<OrganizationUnitDto> { |
|||
return requestClient.put<OrganizationUnitDto>( |
|||
`/api/identity/organization-units/${id}`, |
|||
input, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 查询组织机构分页列表 |
|||
* @param input 过滤参数 |
|||
* @returns 组织机构实体数据传输对象分页列表 |
|||
*/ |
|||
export function getPagedListApi( |
|||
input?: GetOrganizationUnitPagedListInput, |
|||
): Promise<PagedResultDto<OrganizationUnitDto>> { |
|||
return requestClient.get<PagedResultDto<OrganizationUnitDto>>( |
|||
`/api/identity/organization-units`, |
|||
{ |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 查询根组织机构列表 |
|||
* @returns 组织机构实体数据传输对象列表 |
|||
*/ |
|||
export function getRootListApi(): Promise<ListResultDto<OrganizationUnitDto>> { |
|||
return requestClient.get<ListResultDto<OrganizationUnitDto>>( |
|||
`/api/identity/organization-units/root-node`, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 查询组织机构列表 |
|||
* @returns 组织机构实体数据传输对象列表 |
|||
*/ |
|||
export function getAllListApi(): Promise<ListResultDto<OrganizationUnitDto>> { |
|||
return requestClient.get<ListResultDto<OrganizationUnitDto>>( |
|||
`/api/identity/organization-units/all`, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 查询下级组织机构列表 |
|||
* @param input 查询参数 |
|||
* @returns 组织机构实体数据传输对象列表 |
|||
*/ |
|||
export function getChildrenApi( |
|||
input: OrganizationUnitGetChildrenDto, |
|||
): Promise<ListResultDto<OrganizationUnitDto>> { |
|||
return requestClient.get<ListResultDto<OrganizationUnitDto>>( |
|||
`/api/identity/organization-units/find-children`, |
|||
{ |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 查询组织机构用户列表 |
|||
* @param id 组织机构id |
|||
* @param input 查询过滤参数 |
|||
* @returns 用户实体数据传输对象分页列表 |
|||
*/ |
|||
export function getUserListApi( |
|||
id: string, |
|||
input?: GetIdentityUsersInput, |
|||
): Promise<PagedResultDto<IdentityUserDto>> { |
|||
return requestClient.get<PagedResultDto<IdentityUserDto>>( |
|||
`/api/identity/organization-units/${id}/users`, |
|||
{ |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 查询未加入组织机构的用户列表 |
|||
* @param input 查询过滤参数 |
|||
* @returns 用户实体数据传输对象分页列表 |
|||
*/ |
|||
export function getUnaddedUserListApi( |
|||
input: GetUnaddedUserListInput, |
|||
): Promise<PagedResultDto<IdentityUserDto>> { |
|||
return requestClient.get<PagedResultDto<IdentityUserDto>>( |
|||
`/api/identity/organization-units/${input.id}/unadded-users`, |
|||
{ |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 用户添加到组织机构 |
|||
* @param id 组织机构id |
|||
* @param input 用户id列表 |
|||
*/ |
|||
export function addMembers( |
|||
id: string, |
|||
input: OrganizationUnitAddUserDto, |
|||
): Promise<void> { |
|||
return requestClient.post( |
|||
`/api/identity/organization-units/${id}/users`, |
|||
input, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 查询组织机构角色列表 |
|||
* @param id 组织机构id |
|||
* @param input 查询过滤参数 |
|||
* @returns 角色实体数据传输对象分页列表 |
|||
*/ |
|||
export function getRoleListApi( |
|||
id: string, |
|||
input?: GetIdentityRolesInput, |
|||
): Promise<PagedResultDto<IdentityRoleDto>> { |
|||
return requestClient.get<PagedResultDto<IdentityRoleDto>>( |
|||
`/api/identity/organization-units/${id}/roles`, |
|||
{ |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 查询未加入组织机构的角色列表 |
|||
* @param input 查询过滤参数 |
|||
* @returns 角色实体数据传输对象分页列表 |
|||
*/ |
|||
export function getUnaddedRoleListApi( |
|||
input: GetUnaddedRoleListInput, |
|||
): Promise<PagedResultDto<IdentityRoleDto>> { |
|||
return requestClient.get<PagedResultDto<IdentityRoleDto>>( |
|||
`/api/identity/organization-units/${input.id}/unadded-roles`, |
|||
{ |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 角色添加到组织机构 |
|||
* @param id 组织机构id |
|||
* @param input 角色id列表 |
|||
*/ |
|||
export function addRoles( |
|||
id: string, |
|||
input: OrganizationUnitAddRoleDto, |
|||
): Promise<void> { |
|||
return requestClient.post( |
|||
`/api/identity/organization-units/${id}/roles`, |
|||
input, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 移动组织机构 |
|||
* @param id 组织机构id |
|||
* @param parentId 父级组织机构id |
|||
*/ |
|||
export function moveTo(id: string, parentId?: string): Promise<void> { |
|||
return requestClient.put(`api/identity/organization-units/${id}/move`, { |
|||
parentId, |
|||
}); |
|||
} |
|||
@ -1,136 +0,0 @@ |
|||
import type { ListResultDto, PagedResultDto } from '@abp/core'; |
|||
|
|||
import type { |
|||
IdentityClaimCreateDto, |
|||
IdentityClaimDeleteDto, |
|||
IdentityClaimDto, |
|||
IdentityClaimUpdateDto, |
|||
} from '../types/claims'; |
|||
import type { |
|||
GetRolePagedListInput, |
|||
IdentityRoleCreateDto, |
|||
IdentityRoleDto, |
|||
IdentityRoleUpdateDto, |
|||
} from '../types/roles'; |
|||
|
|||
import { requestClient } from '@abp/request'; |
|||
|
|||
/** |
|||
* 新增角色 |
|||
* @param input 参数 |
|||
* @returns 角色实体数据传输对象 |
|||
*/ |
|||
export function createApi( |
|||
input: IdentityRoleCreateDto, |
|||
): Promise<IdentityRoleDto> { |
|||
return requestClient.post<IdentityRoleDto>('/api/identity/roles', input); |
|||
} |
|||
|
|||
/** |
|||
* 删除角色 |
|||
* @param id 角色id |
|||
*/ |
|||
export function deleteApi(id: string): Promise<void> { |
|||
return requestClient.delete(`/api/identity/roles/${id}`); |
|||
} |
|||
|
|||
/** |
|||
* 查询角色 |
|||
* @param id 角色id |
|||
* @returns 角色实体数据传输对象 |
|||
*/ |
|||
export function getApi(id: string): Promise<IdentityRoleDto> { |
|||
return requestClient.get<IdentityRoleDto>(`/api/identity/roles/${id}`); |
|||
} |
|||
|
|||
/** |
|||
* 更新角色 |
|||
* @param id 角色id |
|||
* @returns 角色实体数据传输对象 |
|||
*/ |
|||
export function updateApi( |
|||
id: string, |
|||
input: IdentityRoleUpdateDto, |
|||
): Promise<IdentityRoleDto> { |
|||
return requestClient.put<IdentityRoleDto>(`/api/identity/roles/${id}`, input); |
|||
} |
|||
|
|||
/** |
|||
* 查询角色分页列表 |
|||
* @param input 过滤参数 |
|||
* @returns 角色实体数据传输对象分页列表 |
|||
*/ |
|||
export function getPagedListApi( |
|||
input?: GetRolePagedListInput, |
|||
): Promise<PagedResultDto<IdentityRoleDto>> { |
|||
return requestClient.get<PagedResultDto<IdentityRoleDto>>( |
|||
`/api/identity/roles`, |
|||
{ |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 从组织机构中移除角色 |
|||
* @param id 角色id |
|||
* @param ouId 组织机构id |
|||
*/ |
|||
export function removeOrganizationUnitApi( |
|||
id: string, |
|||
ouId: string, |
|||
): Promise<void> { |
|||
return requestClient.delete( |
|||
`/api/identity/roles/${id}/organization-units/${ouId}`, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 获取角色声明列表 |
|||
* @param id 角色id |
|||
*/ |
|||
export function getClaimsApi( |
|||
id: string, |
|||
): Promise<ListResultDto<IdentityClaimDto>> { |
|||
return requestClient.get<ListResultDto<IdentityClaimDto>>( |
|||
`/api/identity/roles/${id}/claims`, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 删除角色声明 |
|||
* @param id 角色id |
|||
* @param input 角色声明dto |
|||
*/ |
|||
export function deleteClaimApi( |
|||
id: string, |
|||
input: IdentityClaimDeleteDto, |
|||
): Promise<void> { |
|||
return requestClient.delete(`/api/identity/roles/${id}/claims`, { |
|||
params: input, |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 创建角色声明 |
|||
* @param id 角色id |
|||
* @param input 角色声明dto |
|||
*/ |
|||
export function createClaimApi( |
|||
id: string, |
|||
input: IdentityClaimCreateDto, |
|||
): Promise<void> { |
|||
return requestClient.post(`/api/identity/roles/${id}/claims`, input); |
|||
} |
|||
|
|||
/** |
|||
* 更新角色声明 |
|||
* @param id 角色id |
|||
* @param input 用户角色dto |
|||
*/ |
|||
export function updateClaimApi( |
|||
id: string, |
|||
input: IdentityClaimUpdateDto, |
|||
): Promise<void> { |
|||
return requestClient.put(`/api/identity/roles/${id}/claims`, input); |
|||
} |
|||
@ -1,41 +0,0 @@ |
|||
import type { PagedResultDto } from '@abp/core'; |
|||
|
|||
import type { |
|||
GetSecurityLogPagedRequest, |
|||
SecurityLogDto, |
|||
} from '../types/security-logs'; |
|||
|
|||
import { requestClient } from '@abp/request'; |
|||
|
|||
/** |
|||
* 删除安全日志 |
|||
* @param id id |
|||
*/ |
|||
export function deleteApi(id: string): Promise<void> { |
|||
return requestClient.delete(`/api/auditing/security-log/${id}`); |
|||
} |
|||
|
|||
/** |
|||
* 查询安全日志 |
|||
* @param id id |
|||
* @returns 安全日志实体数据传输对象 |
|||
*/ |
|||
export function getApi(id: string): Promise<SecurityLogDto> { |
|||
return requestClient.get<SecurityLogDto>(`/api/auditing/security-log/${id}`); |
|||
} |
|||
|
|||
/** |
|||
* 查询安全日志分页列表 |
|||
* @param input 过滤参数 |
|||
* @returns 安全日志实体数据传输对象分页列表 |
|||
*/ |
|||
export function getPagedListApi( |
|||
input?: GetSecurityLogPagedRequest, |
|||
): Promise<PagedResultDto<SecurityLogDto>> { |
|||
return requestClient.get<PagedResultDto<SecurityLogDto>>( |
|||
`/api/auditing/security-log`, |
|||
{ |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
@ -0,0 +1,105 @@ |
|||
import type { ListResultDto, PagedResultDto } from '@abp/core'; |
|||
|
|||
import type { |
|||
GetIdentityClaimTypePagedListInput, |
|||
IdentityClaimTypeCreateDto, |
|||
IdentityClaimTypeDto, |
|||
IdentityClaimTypeUpdateDto, |
|||
} from '../types'; |
|||
|
|||
import { useRequest } from '@abp/request'; |
|||
|
|||
export function useClaimTypesApi() { |
|||
const { cancel, request } = useRequest(); |
|||
|
|||
/** |
|||
* 新增用户声明 |
|||
* @param input 参数 |
|||
* @returns 用户声明实体数据传输对象 |
|||
*/ |
|||
function createApi( |
|||
input: IdentityClaimTypeCreateDto, |
|||
): Promise<IdentityClaimTypeDto> { |
|||
return request<IdentityClaimTypeDto>('/api/identity/claim-types', { |
|||
data: input, |
|||
method: 'POST', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 删除用户声明 |
|||
* @param id 用户声明id |
|||
*/ |
|||
function deleteApi(id: string): Promise<void> { |
|||
return request(`/api/identity/claim-types/${id}`, { |
|||
method: 'DELETE', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 查询用户声明 |
|||
* @param id 用户声明id |
|||
* @returns 用户声明实体数据传输对象 |
|||
*/ |
|||
function getApi(id: string): Promise<IdentityClaimTypeDto> { |
|||
return request<IdentityClaimTypeDto>(`/api/identity/claim-types/${id}`, { |
|||
method: 'GET', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 更新用户声明 |
|||
* @param id 用户声明id |
|||
* @returns 用户声明实体数据传输对象 |
|||
*/ |
|||
function updateApi( |
|||
id: string, |
|||
input: IdentityClaimTypeUpdateDto, |
|||
): Promise<IdentityClaimTypeDto> { |
|||
return request<IdentityClaimTypeDto>(`/api/identity/claim-types/${id}`, { |
|||
data: input, |
|||
method: 'PUT', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 查询用户声明分页列表 |
|||
* @param input 过滤参数 |
|||
* @returns 用户声明实体数据传输对象分页列表 |
|||
*/ |
|||
function getPagedListApi( |
|||
input?: GetIdentityClaimTypePagedListInput, |
|||
): Promise<PagedResultDto<IdentityClaimTypeDto>> { |
|||
return request<PagedResultDto<IdentityClaimTypeDto>>( |
|||
`/api/identity/claim-types`, |
|||
{ |
|||
method: 'GET', |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 获取可用的声明类型列表 |
|||
*/ |
|||
function getAssignableClaimsApi(): Promise< |
|||
ListResultDto<IdentityClaimTypeDto> |
|||
> { |
|||
return request<ListResultDto<IdentityClaimTypeDto>>( |
|||
`/api/identity/claim-types/actived-list`, |
|||
{ |
|||
method: 'GET', |
|||
}, |
|||
); |
|||
} |
|||
|
|||
return { |
|||
cancel, |
|||
createApi, |
|||
deleteApi, |
|||
getApi, |
|||
getAssignableClaimsApi, |
|||
getPagedListApi, |
|||
updateApi, |
|||
}; |
|||
} |
|||
@ -0,0 +1,271 @@ |
|||
import type { ListResultDto, PagedResultDto } from '@abp/core'; |
|||
|
|||
import type { IdentityRoleDto, IdentityUserDto } from '../types'; |
|||
import type { |
|||
GetIdentityRolesInput, |
|||
GetIdentityUsersInput, |
|||
GetOrganizationUnitPagedListInput, |
|||
GetUnaddedRoleListInput, |
|||
GetUnaddedUserListInput, |
|||
OrganizationUnitAddRoleDto, |
|||
OrganizationUnitAddUserDto, |
|||
OrganizationUnitCreateDto, |
|||
OrganizationUnitDto, |
|||
OrganizationUnitGetChildrenDto, |
|||
OrganizationUnitUpdateDto, |
|||
} from '../types/organization-units'; |
|||
|
|||
import { useRequest } from '@abp/request'; |
|||
|
|||
export function useOrganizationUnitsApi() { |
|||
const { cancel, request } = useRequest(); |
|||
|
|||
/** |
|||
* 新增组织机构 |
|||
* @param input 参数 |
|||
* @returns 组织机构实体数据传输对象 |
|||
*/ |
|||
function createApi( |
|||
input: OrganizationUnitCreateDto, |
|||
): Promise<OrganizationUnitDto> { |
|||
return request<OrganizationUnitDto>('/api/identity/organization-units', { |
|||
data: input, |
|||
method: 'GET', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 删除组织机构 |
|||
* @param id 组织机构id |
|||
*/ |
|||
function deleteApi(id: string): Promise<void> { |
|||
return request(`/api/identity/organization-units/${id}`, { |
|||
method: 'DELETE', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 查询组织机构 |
|||
* @param id 组织机构id |
|||
* @returns 组织机构实体数据传输对象 |
|||
*/ |
|||
function getApi(id: string): Promise<OrganizationUnitDto> { |
|||
return request<OrganizationUnitDto>( |
|||
`/api/identity/organization-units/${id}`, |
|||
{ |
|||
method: 'GET', |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 更新组织机构 |
|||
* @param id 组织机构id |
|||
* @returns 组织机构实体数据传输对象 |
|||
*/ |
|||
function updateApi( |
|||
id: string, |
|||
input: OrganizationUnitUpdateDto, |
|||
): Promise<OrganizationUnitDto> { |
|||
return request<OrganizationUnitDto>( |
|||
`/api/identity/organization-units/${id}`, |
|||
{ |
|||
data: input, |
|||
method: 'PUT', |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 查询组织机构分页列表 |
|||
* @param input 过滤参数 |
|||
* @returns 组织机构实体数据传输对象分页列表 |
|||
*/ |
|||
function getPagedListApi( |
|||
input?: GetOrganizationUnitPagedListInput, |
|||
): Promise<PagedResultDto<OrganizationUnitDto>> { |
|||
return request<PagedResultDto<OrganizationUnitDto>>( |
|||
`/api/identity/organization-units`, |
|||
{ |
|||
method: 'GET', |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 查询根组织机构列表 |
|||
* @returns 组织机构实体数据传输对象列表 |
|||
*/ |
|||
function getRootListApi(): Promise<ListResultDto<OrganizationUnitDto>> { |
|||
return request<ListResultDto<OrganizationUnitDto>>( |
|||
`/api/identity/organization-units/root-node`, |
|||
{ |
|||
method: 'GET', |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 查询组织机构列表 |
|||
* @returns 组织机构实体数据传输对象列表 |
|||
*/ |
|||
function getAllListApi(): Promise<ListResultDto<OrganizationUnitDto>> { |
|||
return request<ListResultDto<OrganizationUnitDto>>( |
|||
`/api/identity/organization-units/all`, |
|||
{ |
|||
method: 'GET', |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 查询下级组织机构列表 |
|||
* @param input 查询参数 |
|||
* @returns 组织机构实体数据传输对象列表 |
|||
*/ |
|||
function getChildrenApi( |
|||
input: OrganizationUnitGetChildrenDto, |
|||
): Promise<ListResultDto<OrganizationUnitDto>> { |
|||
return request<ListResultDto<OrganizationUnitDto>>( |
|||
`/api/identity/organization-units/find-children`, |
|||
{ |
|||
method: 'GET', |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 查询组织机构用户列表 |
|||
* @param id 组织机构id |
|||
* @param input 查询过滤参数 |
|||
* @returns 用户实体数据传输对象分页列表 |
|||
*/ |
|||
function getUserListApi( |
|||
id: string, |
|||
input?: GetIdentityUsersInput, |
|||
): Promise<PagedResultDto<IdentityUserDto>> { |
|||
return request<PagedResultDto<IdentityUserDto>>( |
|||
`/api/identity/organization-units/${id}/users`, |
|||
{ |
|||
method: 'GET', |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 查询未加入组织机构的用户列表 |
|||
* @param input 查询过滤参数 |
|||
* @returns 用户实体数据传输对象分页列表 |
|||
*/ |
|||
function getUnaddedUserListApi( |
|||
input: GetUnaddedUserListInput, |
|||
): Promise<PagedResultDto<IdentityUserDto>> { |
|||
return request<PagedResultDto<IdentityUserDto>>( |
|||
`/api/identity/organization-units/${input.id}/unadded-users`, |
|||
{ |
|||
method: 'GET', |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 用户添加到组织机构 |
|||
* @param id 组织机构id |
|||
* @param input 用户id列表 |
|||
*/ |
|||
function addMembers( |
|||
id: string, |
|||
input: OrganizationUnitAddUserDto, |
|||
): Promise<void> { |
|||
return request(`/api/identity/organization-units/${id}/users`, { |
|||
data: input, |
|||
method: 'POST', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 查询组织机构角色列表 |
|||
* @param id 组织机构id |
|||
* @param input 查询过滤参数 |
|||
* @returns 角色实体数据传输对象分页列表 |
|||
*/ |
|||
function getRoleListApi( |
|||
id: string, |
|||
input?: GetIdentityRolesInput, |
|||
): Promise<PagedResultDto<IdentityRoleDto>> { |
|||
return request<PagedResultDto<IdentityRoleDto>>( |
|||
`/api/identity/organization-units/${id}/roles`, |
|||
{ |
|||
method: 'GET', |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 查询未加入组织机构的角色列表 |
|||
* @param input 查询过滤参数 |
|||
* @returns 角色实体数据传输对象分页列表 |
|||
*/ |
|||
function getUnaddedRoleListApi( |
|||
input: GetUnaddedRoleListInput, |
|||
): Promise<PagedResultDto<IdentityRoleDto>> { |
|||
return request<PagedResultDto<IdentityRoleDto>>( |
|||
`/api/identity/organization-units/${input.id}/unadded-roles`, |
|||
{ |
|||
method: 'GET', |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 角色添加到组织机构 |
|||
* @param id 组织机构id |
|||
* @param input 角色id列表 |
|||
*/ |
|||
function addRoles( |
|||
id: string, |
|||
input: OrganizationUnitAddRoleDto, |
|||
): Promise<void> { |
|||
return request(`/api/identity/organization-units/${id}/roles`, { |
|||
data: input, |
|||
method: 'GET', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 移动组织机构 |
|||
* @param id 组织机构id |
|||
* @param parentId 父级组织机构id |
|||
*/ |
|||
function moveTo(id: string, parentId?: string): Promise<void> { |
|||
return request(`api/identity/organization-units/${id}/move`, { |
|||
data: { parentId }, |
|||
method: 'PUT', |
|||
}); |
|||
} |
|||
|
|||
return { |
|||
addMembers, |
|||
addRoles, |
|||
cancel, |
|||
createApi, |
|||
deleteApi, |
|||
getAllListApi, |
|||
getApi, |
|||
getChildrenApi, |
|||
getPagedListApi, |
|||
getRoleListApi, |
|||
getRootListApi, |
|||
getUnaddedRoleListApi, |
|||
getUnaddedUserListApi, |
|||
getUserListApi, |
|||
moveTo, |
|||
updateApi, |
|||
}; |
|||
} |
|||
@ -0,0 +1,164 @@ |
|||
import type { ListResultDto, PagedResultDto } from '@abp/core'; |
|||
|
|||
import type { |
|||
IdentityClaimCreateDto, |
|||
IdentityClaimDeleteDto, |
|||
IdentityClaimDto, |
|||
IdentityClaimUpdateDto, |
|||
} from '../types/claims'; |
|||
import type { |
|||
GetRolePagedListInput, |
|||
IdentityRoleCreateDto, |
|||
IdentityRoleDto, |
|||
IdentityRoleUpdateDto, |
|||
} from '../types/roles'; |
|||
|
|||
import { useRequest } from '@abp/request'; |
|||
|
|||
export function useRolesApi() { |
|||
const { cancel, request } = useRequest(); |
|||
/** |
|||
* 新增角色 |
|||
* @param input 参数 |
|||
* @returns 角色实体数据传输对象 |
|||
*/ |
|||
function createApi(input: IdentityRoleCreateDto): Promise<IdentityRoleDto> { |
|||
return request<IdentityRoleDto>('/api/identity/roles', { |
|||
data: input, |
|||
method: 'POST', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 删除角色 |
|||
* @param id 角色id |
|||
*/ |
|||
function deleteApi(id: string): Promise<void> { |
|||
return request(`/api/identity/roles/${id}`, { |
|||
method: 'DELETE', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 查询角色 |
|||
* @param id 角色id |
|||
* @returns 角色实体数据传输对象 |
|||
*/ |
|||
function getApi(id: string): Promise<IdentityRoleDto> { |
|||
return request<IdentityRoleDto>(`/api/identity/roles/${id}`, { |
|||
method: 'GET', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 更新角色 |
|||
* @param id 角色id |
|||
* @returns 角色实体数据传输对象 |
|||
*/ |
|||
function updateApi( |
|||
id: string, |
|||
input: IdentityRoleUpdateDto, |
|||
): Promise<IdentityRoleDto> { |
|||
return request<IdentityRoleDto>(`/api/identity/roles/${id}`, { |
|||
data: input, |
|||
method: 'PUT', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 查询角色分页列表 |
|||
* @param input 过滤参数 |
|||
* @returns 角色实体数据传输对象分页列表 |
|||
*/ |
|||
function getPagedListApi( |
|||
input?: GetRolePagedListInput, |
|||
): Promise<PagedResultDto<IdentityRoleDto>> { |
|||
return request<PagedResultDto<IdentityRoleDto>>(`/api/identity/roles`, { |
|||
method: 'GET', |
|||
params: input, |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 从组织机构中移除角色 |
|||
* @param id 角色id |
|||
* @param ouId 组织机构id |
|||
*/ |
|||
function removeOrganizationUnitApi(id: string, ouId: string): Promise<void> { |
|||
return request(`/api/identity/roles/${id}/organization-units/${ouId}`, { |
|||
method: 'DELETE', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 获取角色声明列表 |
|||
* @param id 角色id |
|||
*/ |
|||
function getClaimsApi(id: string): Promise<ListResultDto<IdentityClaimDto>> { |
|||
return request<ListResultDto<IdentityClaimDto>>( |
|||
`/api/identity/roles/${id}/claims`, |
|||
{ |
|||
method: 'GET', |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 删除角色声明 |
|||
* @param id 角色id |
|||
* @param input 角色声明dto |
|||
*/ |
|||
function deleteClaimApi( |
|||
id: string, |
|||
input: IdentityClaimDeleteDto, |
|||
): Promise<void> { |
|||
return request(`/api/identity/roles/${id}/claims`, { |
|||
method: 'DELETE', |
|||
params: input, |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 创建角色声明 |
|||
* @param id 角色id |
|||
* @param input 角色声明dto |
|||
*/ |
|||
function createClaimApi( |
|||
id: string, |
|||
input: IdentityClaimCreateDto, |
|||
): Promise<void> { |
|||
return request(`/api/identity/roles/${id}/claims`, { |
|||
data: input, |
|||
method: 'POST', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 更新角色声明 |
|||
* @param id 角色id |
|||
* @param input 用户角色dto |
|||
*/ |
|||
function updateClaimApi( |
|||
id: string, |
|||
input: IdentityClaimUpdateDto, |
|||
): Promise<void> { |
|||
return request(`/api/identity/roles/${id}/claims`, { |
|||
data: input, |
|||
method: 'PUT', |
|||
}); |
|||
} |
|||
|
|||
return { |
|||
cancel, |
|||
createApi, |
|||
createClaimApi, |
|||
deleteApi, |
|||
deleteClaimApi, |
|||
getApi, |
|||
getClaimsApi, |
|||
getPagedListApi, |
|||
removeOrganizationUnitApi, |
|||
updateApi, |
|||
updateClaimApi, |
|||
}; |
|||
} |
|||
@ -0,0 +1,57 @@ |
|||
import type { PagedResultDto } from '@abp/core'; |
|||
|
|||
import type { |
|||
GetSecurityLogPagedRequest, |
|||
SecurityLogDto, |
|||
} from '../types/security-logs'; |
|||
|
|||
import { useRequest } from '@abp/request'; |
|||
|
|||
export function useSecurityLogsApi() { |
|||
const { cancel, request } = useRequest(); |
|||
|
|||
/** |
|||
* 删除安全日志 |
|||
* @param id id |
|||
*/ |
|||
function deleteApi(id: string): Promise<void> { |
|||
return request(`/api/auditing/security-log/${id}`, { |
|||
method: 'DELETE', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 查询安全日志 |
|||
* @param id id |
|||
* @returns 安全日志实体数据传输对象 |
|||
*/ |
|||
function getApi(id: string): Promise<SecurityLogDto> { |
|||
return request<SecurityLogDto>(`/api/auditing/security-log/${id}`, { |
|||
method: 'GET', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 查询安全日志分页列表 |
|||
* @param input 过滤参数 |
|||
* @returns 安全日志实体数据传输对象分页列表 |
|||
*/ |
|||
function getPagedListApi( |
|||
input?: GetSecurityLogPagedRequest, |
|||
): Promise<PagedResultDto<SecurityLogDto>> { |
|||
return request<PagedResultDto<SecurityLogDto>>( |
|||
`/api/auditing/security-log`, |
|||
{ |
|||
method: 'GET', |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
return { |
|||
cancel, |
|||
deleteApi, |
|||
getApi, |
|||
getPagedListApi, |
|||
}; |
|||
} |
|||
@ -0,0 +1,74 @@ |
|||
import type { ListResultDto } from '@abp/core'; |
|||
|
|||
import type { |
|||
IdentityUserDto, |
|||
UserLookupCountInput, |
|||
UserLookupSearchInput, |
|||
} from '../types/users'; |
|||
|
|||
import { useRequest } from '@abp/request'; |
|||
|
|||
export function useUserLookup() { |
|||
const { cancel, request } = useRequest(); |
|||
|
|||
/** |
|||
* 通过id查询用户 |
|||
* @param id 用户id |
|||
* @returns 用户实体数据传输对象 |
|||
*/ |
|||
function findByIdApi(id: string): Promise<IdentityUserDto> { |
|||
return request<IdentityUserDto>(`/api/identity/users/lookup/${id}`, { |
|||
method: 'GET', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 通过用户名查询用户 |
|||
* @param userName 用户名 |
|||
* @returns 用户实体数据传输对象 |
|||
*/ |
|||
function findByUserNameApi(userName: string): Promise<IdentityUserDto> { |
|||
return request<IdentityUserDto>( |
|||
`/api/identity/users/lookup/by-username/${userName}`, |
|||
{ |
|||
method: 'GET', |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 搜索用户列表 |
|||
* @param input 搜索过滤条件 |
|||
* @returns 用户实体数据传输对象列表 |
|||
*/ |
|||
function searchApi( |
|||
input?: UserLookupSearchInput, |
|||
): Promise<ListResultDto<IdentityUserDto>> { |
|||
return request<ListResultDto<IdentityUserDto>>( |
|||
`/api/identity/users/lookup/search`, |
|||
{ |
|||
method: 'GET', |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 搜索用户数量 |
|||
* @param input 搜索过滤条件 |
|||
*/ |
|||
function countApi(input?: UserLookupCountInput): Promise<number> { |
|||
return request<number>(`/api/identity/users/lookup/count`, { |
|||
method: 'GET', |
|||
params: input, |
|||
}); |
|||
} |
|||
|
|||
return { |
|||
cancel, |
|||
countApi, |
|||
findByIdApi, |
|||
findByUserNameApi, |
|||
searchApi, |
|||
}; |
|||
} |
|||
@ -0,0 +1,249 @@ |
|||
import type { ListResultDto, PagedResultDto } from '@abp/core'; |
|||
|
|||
import type { IdentityRoleDto, OrganizationUnitDto } from '../types'; |
|||
import type { |
|||
IdentityClaimCreateDto, |
|||
IdentityClaimDeleteDto, |
|||
IdentityClaimDto, |
|||
IdentityClaimUpdateDto, |
|||
} from '../types/claims'; |
|||
import type { |
|||
ChangeUserPasswordInput, |
|||
GetUserPagedListInput, |
|||
IdentityUserCreateDto, |
|||
IdentityUserDto, |
|||
IdentityUserUpdateDto, |
|||
} from '../types/users'; |
|||
|
|||
import { useRequest } from '@abp/request'; |
|||
|
|||
export function useUserApi() { |
|||
const { cancel, request } = useRequest(); |
|||
|
|||
/** |
|||
* 新增用户 |
|||
* @param input 参数 |
|||
* @returns 用户实体数据传输对象 |
|||
*/ |
|||
function createApi(input: IdentityUserCreateDto): Promise<IdentityUserDto> { |
|||
return request<IdentityUserDto>('/api/identity/users', { |
|||
data: input, |
|||
method: 'POST', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 删除用户 |
|||
* @param id 用户id |
|||
*/ |
|||
function deleteApi(id: string): Promise<void> { |
|||
return request(`/api/identity/users/${id}`, { |
|||
method: 'DELETE', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 查询用户 |
|||
* @param id 用户id |
|||
* @returns 用户实体数据传输对象 |
|||
*/ |
|||
function getApi(id: string): Promise<IdentityUserDto> { |
|||
return request<IdentityUserDto>(`/api/identity/users/${id}`, { |
|||
method: 'GET', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 更新用户 |
|||
* @param id 用户id |
|||
* @returns 用户实体数据传输对象 |
|||
*/ |
|||
function updateApi( |
|||
id: string, |
|||
input: IdentityUserUpdateDto, |
|||
): Promise<IdentityUserDto> { |
|||
return request<IdentityUserDto>(`/api/identity/users/${id}`, { |
|||
data: input, |
|||
method: 'PUT', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 查询用户分页列表 |
|||
* @param input 过滤参数 |
|||
* @returns 用户实体数据传输对象分页列表 |
|||
*/ |
|||
function getPagedListApi( |
|||
input?: GetUserPagedListInput, |
|||
): Promise<PagedResultDto<IdentityUserDto>> { |
|||
return request<PagedResultDto<IdentityUserDto>>(`/api/identity/users`, { |
|||
method: 'GET', |
|||
params: input, |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 从组织机构中移除用户 |
|||
* @param id 用户id |
|||
* @param ouId 组织机构id |
|||
*/ |
|||
function removeOrganizationUnitApi(id: string, ouId: string): Promise<void> { |
|||
return request(`/api/identity/users/${id}/organization-units/${ouId}`, { |
|||
method: 'DELETE', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 获取用户组织机构列表 |
|||
* @param id 用户id |
|||
*/ |
|||
function getOrganizationUnitsApi( |
|||
id: string, |
|||
): Promise<ListResultDto<OrganizationUnitDto>> { |
|||
return request<ListResultDto<OrganizationUnitDto>>( |
|||
`/api/identity/users/${id}/organization-units`, |
|||
{ |
|||
method: 'GET', |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 锁定用户 |
|||
* @param id 用户id |
|||
* @param seconds 锁定时长(秒) |
|||
*/ |
|||
function lockApi(id: string, seconds: number): Promise<void> { |
|||
return request(`/api/identity/users/${id}/lock/${seconds}`, { |
|||
method: 'PUT', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 解锁用户 |
|||
* @param id 用户id |
|||
*/ |
|||
function unLockApi(id: string): Promise<void> { |
|||
return request(`/api/identity/users/${id}/unlock`, { |
|||
method: 'PUT', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 更改用户密码 |
|||
* @param id 用户id |
|||
* @param input 密码变更dto |
|||
*/ |
|||
function changePasswordApi( |
|||
id: string, |
|||
input: ChangeUserPasswordInput, |
|||
): Promise<void> { |
|||
return request(`/api/identity/users/change-password?id=${id}`, { |
|||
data: input, |
|||
method: 'PUT', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 获取可用的角色列表 |
|||
*/ |
|||
function getAssignableRolesApi(): Promise<ListResultDto<IdentityRoleDto>> { |
|||
return request<ListResultDto<IdentityRoleDto>>( |
|||
`/api/identity/users/assignable-roles`, |
|||
{ |
|||
method: 'GET', |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 获取用户角色列表 |
|||
* @param id 用户id |
|||
*/ |
|||
function getRolesApi(id: string): Promise<ListResultDto<IdentityRoleDto>> { |
|||
return request<ListResultDto<IdentityRoleDto>>( |
|||
`/api/identity/users/${id}/roles`, |
|||
{ |
|||
method: 'GET', |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 获取用户声明列表 |
|||
* @param id 用户id |
|||
*/ |
|||
function getClaimsApi(id: string): Promise<ListResultDto<IdentityClaimDto>> { |
|||
return request<ListResultDto<IdentityClaimDto>>( |
|||
`/api/identity/users/${id}/claims`, |
|||
{ |
|||
method: 'GET', |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 删除用户声明 |
|||
* @param id 用户id |
|||
* @param input 用户声明dto |
|||
*/ |
|||
function deleteClaimApi( |
|||
id: string, |
|||
input: IdentityClaimDeleteDto, |
|||
): Promise<void> { |
|||
return request(`/api/identity/users/${id}/claims`, { |
|||
method: 'DELETE', |
|||
params: input, |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 创建用户声明 |
|||
* @param id 用户id |
|||
* @param input 用户声明dto |
|||
*/ |
|||
function createClaimApi( |
|||
id: string, |
|||
input: IdentityClaimCreateDto, |
|||
): Promise<void> { |
|||
return request(`/api/identity/users/${id}/claims`, { |
|||
data: input, |
|||
method: 'POST', |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 更新用户声明 |
|||
* @param id 用户id |
|||
* @param input 用户声明dto |
|||
*/ |
|||
function updateClaimApi( |
|||
id: string, |
|||
input: IdentityClaimUpdateDto, |
|||
): Promise<void> { |
|||
return request(`/api/identity/users/${id}/claims`, { |
|||
data: input, |
|||
method: 'PUT', |
|||
}); |
|||
} |
|||
|
|||
return { |
|||
cancel, |
|||
changePasswordApi, |
|||
createApi, |
|||
createClaimApi, |
|||
deleteApi, |
|||
deleteClaimApi, |
|||
getApi, |
|||
getAssignableRolesApi, |
|||
getClaimsApi, |
|||
getOrganizationUnitsApi, |
|||
getPagedListApi, |
|||
getRolesApi, |
|||
lockApi, |
|||
removeOrganizationUnitApi, |
|||
unLockApi, |
|||
updateApi, |
|||
updateClaimApi, |
|||
}; |
|||
} |
|||
@ -1,55 +0,0 @@ |
|||
import type { ListResultDto } from '@abp/core'; |
|||
|
|||
import type { |
|||
IdentityUserDto, |
|||
UserLookupCountInput, |
|||
UserLookupSearchInput, |
|||
} from '../types/users'; |
|||
|
|||
import { requestClient } from '@abp/request'; |
|||
|
|||
/** |
|||
* 通过id查询用户 |
|||
* @param id 用户id |
|||
* @returns 用户实体数据传输对象 |
|||
*/ |
|||
export function findByIdApi(id: string): Promise<IdentityUserDto> { |
|||
return requestClient.get<IdentityUserDto>(`/api/identity/users/lookup/${id}`); |
|||
} |
|||
|
|||
/** |
|||
* 通过用户名查询用户 |
|||
* @param userName 用户名 |
|||
* @returns 用户实体数据传输对象 |
|||
*/ |
|||
export function findByUserNameApi(userName: string): Promise<IdentityUserDto> { |
|||
return requestClient.get<IdentityUserDto>( |
|||
`/api/identity/users/lookup/by-username/${userName}`, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 搜索用户列表 |
|||
* @param input 搜索过滤条件 |
|||
* @returns 用户实体数据传输对象列表 |
|||
*/ |
|||
export function searchApi( |
|||
input?: UserLookupSearchInput, |
|||
): Promise<ListResultDto<IdentityUserDto>> { |
|||
return requestClient.get<ListResultDto<IdentityUserDto>>( |
|||
`/api/identity/users/lookup/search`, |
|||
{ |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 搜索用户数量 |
|||
* @param input 搜索过滤条件 |
|||
*/ |
|||
export function countApi(input?: UserLookupCountInput): Promise<number> { |
|||
return requestClient.get<number>(`/api/identity/users/lookup/count`, { |
|||
params: input, |
|||
}); |
|||
} |
|||
@ -1,205 +0,0 @@ |
|||
import type { ListResultDto, PagedResultDto } from '@abp/core'; |
|||
|
|||
import type { IdentityRoleDto, OrganizationUnitDto } from '../types'; |
|||
import type { |
|||
IdentityClaimCreateDto, |
|||
IdentityClaimDeleteDto, |
|||
IdentityClaimDto, |
|||
IdentityClaimUpdateDto, |
|||
} from '../types/claims'; |
|||
import type { |
|||
ChangeUserPasswordInput, |
|||
GetUserPagedListInput, |
|||
IdentityUserCreateDto, |
|||
IdentityUserDto, |
|||
IdentityUserUpdateDto, |
|||
} from '../types/users'; |
|||
|
|||
import { requestClient } from '@abp/request'; |
|||
|
|||
/** |
|||
* 新增用户 |
|||
* @param input 参数 |
|||
* @returns 用户实体数据传输对象 |
|||
*/ |
|||
export function createApi( |
|||
input: IdentityUserCreateDto, |
|||
): Promise<IdentityUserDto> { |
|||
return requestClient.post<IdentityUserDto>('/api/identity/users', input); |
|||
} |
|||
|
|||
/** |
|||
* 删除用户 |
|||
* @param id 用户id |
|||
*/ |
|||
export function deleteApi(id: string): Promise<void> { |
|||
return requestClient.delete(`/api/identity/users/${id}`); |
|||
} |
|||
|
|||
/** |
|||
* 查询用户 |
|||
* @param id 用户id |
|||
* @returns 用户实体数据传输对象 |
|||
*/ |
|||
export function getApi(id: string): Promise<IdentityUserDto> { |
|||
return requestClient.get<IdentityUserDto>(`/api/identity/users/${id}`); |
|||
} |
|||
|
|||
/** |
|||
* 更新用户 |
|||
* @param id 用户id |
|||
* @returns 用户实体数据传输对象 |
|||
*/ |
|||
export function updateApi( |
|||
id: string, |
|||
input: IdentityUserUpdateDto, |
|||
): Promise<IdentityUserDto> { |
|||
return requestClient.put<IdentityUserDto>(`/api/identity/users/${id}`, input); |
|||
} |
|||
|
|||
/** |
|||
* 查询用户分页列表 |
|||
* @param input 过滤参数 |
|||
* @returns 用户实体数据传输对象分页列表 |
|||
*/ |
|||
export function getPagedListApi( |
|||
input?: GetUserPagedListInput, |
|||
): Promise<PagedResultDto<IdentityUserDto>> { |
|||
return requestClient.get<PagedResultDto<IdentityUserDto>>( |
|||
`/api/identity/users`, |
|||
{ |
|||
params: input, |
|||
}, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 从组织机构中移除用户 |
|||
* @param id 用户id |
|||
* @param ouId 组织机构id |
|||
*/ |
|||
export function removeOrganizationUnitApi( |
|||
id: string, |
|||
ouId: string, |
|||
): Promise<void> { |
|||
return requestClient.delete( |
|||
`/api/identity/users/${id}/organization-units/${ouId}`, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 获取用户组织机构列表 |
|||
* @param id 用户id |
|||
*/ |
|||
export function getOrganizationUnitsApi( |
|||
id: string, |
|||
): Promise<ListResultDto<OrganizationUnitDto>> { |
|||
return requestClient.get<ListResultDto<OrganizationUnitDto>>( |
|||
`/api/identity/users/${id}/organization-units`, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 锁定用户 |
|||
* @param id 用户id |
|||
* @param seconds 锁定时长(秒) |
|||
*/ |
|||
export function lockApi(id: string, seconds: number): Promise<void> { |
|||
return requestClient.put(`/api/identity/users/${id}/lock/${seconds}`); |
|||
} |
|||
|
|||
/** |
|||
* 解锁用户 |
|||
* @param id 用户id |
|||
*/ |
|||
export function unLockApi(id: string): Promise<void> { |
|||
return requestClient.put(`/api/identity/users/${id}/unlock`); |
|||
} |
|||
|
|||
/** |
|||
* 更改用户密码 |
|||
* @param id 用户id |
|||
* @param input 密码变更dto |
|||
*/ |
|||
export function changePasswordApi( |
|||
id: string, |
|||
input: ChangeUserPasswordInput, |
|||
): Promise<void> { |
|||
return requestClient.put( |
|||
`/api/identity/users/change-password?id=${id}`, |
|||
input, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 获取可用的角色列表 |
|||
*/ |
|||
export function getAssignableRolesApi(): Promise< |
|||
ListResultDto<IdentityRoleDto> |
|||
> { |
|||
return requestClient.get<ListResultDto<IdentityRoleDto>>( |
|||
`/api/identity/users/assignable-roles`, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 获取用户角色列表 |
|||
* @param id 用户id |
|||
*/ |
|||
export function getRolesApi( |
|||
id: string, |
|||
): Promise<ListResultDto<IdentityRoleDto>> { |
|||
return requestClient.get<ListResultDto<IdentityRoleDto>>( |
|||
`/api/identity/users/${id}/roles`, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 获取用户声明列表 |
|||
* @param id 用户id |
|||
*/ |
|||
export function getClaimsApi( |
|||
id: string, |
|||
): Promise<ListResultDto<IdentityClaimDto>> { |
|||
return requestClient.get<ListResultDto<IdentityClaimDto>>( |
|||
`/api/identity/users/${id}/claims`, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 删除用户声明 |
|||
* @param id 用户id |
|||
* @param input 用户声明dto |
|||
*/ |
|||
export function deleteClaimApi( |
|||
id: string, |
|||
input: IdentityClaimDeleteDto, |
|||
): Promise<void> { |
|||
return requestClient.delete(`/api/identity/users/${id}/claims`, { |
|||
params: input, |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 创建用户声明 |
|||
* @param id 用户id |
|||
* @param input 用户声明dto |
|||
*/ |
|||
export function createClaimApi( |
|||
id: string, |
|||
input: IdentityClaimCreateDto, |
|||
): Promise<void> { |
|||
return requestClient.post(`/api/identity/users/${id}/claims`, input); |
|||
} |
|||
|
|||
/** |
|||
* 更新用户声明 |
|||
* @param id 用户id |
|||
* @param input 用户声明dto |
|||
*/ |
|||
export function updateClaimApi( |
|||
id: string, |
|||
input: IdentityClaimUpdateDto, |
|||
): Promise<void> { |
|||
return requestClient.put(`/api/identity/users/${id}/claims`, input); |
|||
} |
|||
@ -0,0 +1 @@ |
|||
export * from './useRequest'; |
|||
@ -0,0 +1,60 @@ |
|||
import type { AxiosRequestConfig } from 'axios'; |
|||
|
|||
import { onUnmounted } from 'vue'; |
|||
|
|||
import { requestClient } from '@abp/request'; |
|||
|
|||
type HttpMethod = |
|||
| 'CONNECT' |
|||
| 'DELETE' |
|||
| 'GET' |
|||
| 'HEAD' |
|||
| 'OPTIONS' |
|||
| 'PATCH' |
|||
| 'POST' |
|||
| 'PURGE' |
|||
| 'PUT' |
|||
| 'TRACE'; |
|||
|
|||
interface RequestConfig extends AxiosRequestConfig { |
|||
method: HttpMethod; |
|||
} |
|||
|
|||
interface RequestLifeCycle { |
|||
/** 是否自动销毁令牌 */ |
|||
autoDestroy?: boolean; |
|||
} |
|||
|
|||
export function useRequest(options?: RequestLifeCycle) { |
|||
const controllers = new Set<AbortController>(); |
|||
|
|||
function request<T>(url: string, config: RequestConfig): Promise<T> { |
|||
const controller = new AbortController(); |
|||
controllers.add(controller); |
|||
return requestClient |
|||
.request<T>(url, { |
|||
...config, |
|||
signal: controller.signal, |
|||
}) |
|||
.finally(() => { |
|||
controllers.delete(controller); |
|||
}); |
|||
} |
|||
|
|||
function cancel(message?: string) { |
|||
controllers.forEach((controller) => controller.abort(message)); |
|||
controllers.clear(); |
|||
} |
|||
|
|||
onUnmounted(() => { |
|||
if (options?.autoDestroy === false) { |
|||
return; |
|||
} |
|||
cancel('The Component has Unmounted!'); |
|||
}); |
|||
|
|||
return { |
|||
cancel, |
|||
request, |
|||
}; |
|||
} |
|||
@ -0,0 +1 @@ |
|||
export type { CancelToken as CancellationToken } from 'axios'; |
|||
File diff suppressed because it is too large
Loading…
Reference in new issue