mirror of https://github.com/abpframework/abp.git
16 changed files with 4644 additions and 44 deletions
File diff suppressed because it is too large
@ -0,0 +1,58 @@ |
|||
import type { ListResultDto, PagedAndSortedResultRequestDto, PagedResultDto } from '@abp/ng.core'; |
|||
import { RestService } from '@abp/ng.core'; |
|||
import { Injectable } from '@angular/core'; |
|||
import type { IdentityRoleCreateDto, IdentityRoleDto, IdentityRoleUpdateDto } from './models'; |
|||
|
|||
@Injectable({ |
|||
providedIn: 'root', |
|||
}) |
|||
export class IdentityRoleService { |
|||
apiName = 'AbpIdentity'; |
|||
|
|||
create = (input: IdentityRoleCreateDto) => |
|||
this.restService.request<any, IdentityRoleDto>({ |
|||
method: 'POST', |
|||
url: '/api/identity/roles', |
|||
body: input, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
delete = (id: string) => |
|||
this.restService.request<any, void>({ |
|||
method: 'DELETE', |
|||
url: `/api/identity/roles/${id}`, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
get = (id: string) => |
|||
this.restService.request<any, IdentityRoleDto>({ |
|||
method: 'GET', |
|||
url: `/api/identity/roles/${id}`, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
getAllList = () => |
|||
this.restService.request<any, ListResultDto<IdentityRoleDto>>({ |
|||
method: 'GET', |
|||
url: '/api/identity/roles/all', |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
getList = (input: PagedAndSortedResultRequestDto) => |
|||
this.restService.request<any, PagedResultDto<IdentityRoleDto>>({ |
|||
method: 'GET', |
|||
url: '/api/identity/roles', |
|||
params: { sorting: input.sorting, skipCount: input.skipCount, maxResultCount: input.maxResultCount }, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
update = (id: string, input: IdentityRoleUpdateDto) => |
|||
this.restService.request<any, IdentityRoleDto>({ |
|||
method: 'PUT', |
|||
url: `/api/identity/roles/${id}`, |
|||
body: input, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
constructor(private restService: RestService) {} |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
import type { UserLookupCountInputDto, UserLookupSearchInputDto } from './models'; |
|||
import { RestService } from '@abp/ng.core'; |
|||
import type { ListResultDto } from '@abp/ng.core'; |
|||
import { Injectable } from '@angular/core'; |
|||
import type { UserData } from '../users/models'; |
|||
|
|||
@Injectable({ |
|||
providedIn: 'root', |
|||
}) |
|||
export class IdentityUserLookupService { |
|||
apiName = 'AbpIdentity'; |
|||
|
|||
findById = (id: string) => |
|||
this.restService.request<any, UserData>({ |
|||
method: 'GET', |
|||
url: `/api/identity/users/lookup/${id}`, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
findByUserName = (userName: string) => |
|||
this.restService.request<any, UserData>({ |
|||
method: 'GET', |
|||
url: `/api/identity/users/lookup/by-username/${userName}`, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
getCount = (input: UserLookupCountInputDto) => |
|||
this.restService.request<any, number>({ |
|||
method: 'GET', |
|||
url: '/api/identity/users/lookup/count', |
|||
params: { filter: input.filter }, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
search = (input: UserLookupSearchInputDto) => |
|||
this.restService.request<any, ListResultDto<UserData>>({ |
|||
method: 'GET', |
|||
url: '/api/identity/users/lookup/search', |
|||
params: { filter: input.filter, sorting: input.sorting, skipCount: input.skipCount, maxResultCount: input.maxResultCount }, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
constructor(private restService: RestService) {} |
|||
} |
|||
@ -0,0 +1,87 @@ |
|||
import type { GetIdentityUsersInput, IdentityRoleDto, IdentityUserCreateDto, IdentityUserDto, IdentityUserUpdateDto, IdentityUserUpdateRolesDto } from './models'; |
|||
import { RestService } from '@abp/ng.core'; |
|||
import type { ListResultDto, PagedResultDto } from '@abp/ng.core'; |
|||
import { Injectable } from '@angular/core'; |
|||
|
|||
@Injectable({ |
|||
providedIn: 'root', |
|||
}) |
|||
export class IdentityUserService { |
|||
apiName = 'AbpIdentity'; |
|||
|
|||
create = (input: IdentityUserCreateDto) => |
|||
this.restService.request<any, IdentityUserDto>({ |
|||
method: 'POST', |
|||
url: '/api/identity/users', |
|||
body: input, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
delete = (id: string) => |
|||
this.restService.request<any, void>({ |
|||
method: 'DELETE', |
|||
url: `/api/identity/users/${id}`, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
findByEmail = (email: string) => |
|||
this.restService.request<any, IdentityUserDto>({ |
|||
method: 'GET', |
|||
url: `/api/identity/users/by-email/${email}`, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
findByUsername = (username: string) => |
|||
this.restService.request<any, IdentityUserDto>({ |
|||
method: 'GET', |
|||
url: '/api/identity/users/by-username/{userName}', |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
get = (id: string) => |
|||
this.restService.request<any, IdentityUserDto>({ |
|||
method: 'GET', |
|||
url: `/api/identity/users/${id}`, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
getAssignableRoles = () => |
|||
this.restService.request<any, ListResultDto<IdentityRoleDto>>({ |
|||
method: 'GET', |
|||
url: '/api/identity/users/assignable-roles', |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
getList = (input: GetIdentityUsersInput) => |
|||
this.restService.request<any, PagedResultDto<IdentityUserDto>>({ |
|||
method: 'GET', |
|||
url: '/api/identity/users', |
|||
params: { filter: input.filter, sorting: input.sorting, skipCount: input.skipCount, maxResultCount: input.maxResultCount }, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
getRoles = (id: string) => |
|||
this.restService.request<any, ListResultDto<IdentityRoleDto>>({ |
|||
method: 'GET', |
|||
url: `/api/identity/users/${id}/roles`, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
update = (id: string, input: IdentityUserUpdateDto) => |
|||
this.restService.request<any, IdentityUserDto>({ |
|||
method: 'PUT', |
|||
url: `/api/identity/users/${id}`, |
|||
body: input, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
updateRoles = (id: string, input: IdentityUserUpdateRolesDto) => |
|||
this.restService.request<any, void>({ |
|||
method: 'PUT', |
|||
url: `/api/identity/users/${id}/roles`, |
|||
body: input, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
constructor(private restService: RestService) {} |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
export * from './identity-role.service'; |
|||
export * from './identity-user-lookup.service'; |
|||
export * from './identity-user.service'; |
|||
export * from './models'; |
|||
export * from './profile.service'; |
|||
@ -0,0 +1,96 @@ |
|||
import type { ExtensibleEntityDto, ExtensibleFullAuditedEntityDto, ExtensibleObject, PagedAndSortedResultRequestDto } from '@abp/ng.core'; |
|||
|
|||
export interface ChangePasswordInput { |
|||
currentPassword: string; |
|||
newPassword: string; |
|||
} |
|||
|
|||
export interface GetIdentityUsersInput extends PagedAndSortedResultRequestDto { |
|||
filter: string; |
|||
} |
|||
|
|||
export interface IdentityRoleCreateDto extends IdentityRoleCreateOrUpdateDtoBase { |
|||
} |
|||
|
|||
export interface IdentityRoleCreateOrUpdateDtoBase extends ExtensibleObject { |
|||
name: string; |
|||
isDefault: boolean; |
|||
isPublic: boolean; |
|||
} |
|||
|
|||
export interface IdentityRoleDto extends ExtensibleEntityDto<string> { |
|||
name: string; |
|||
isDefault: boolean; |
|||
isStatic: boolean; |
|||
isPublic: boolean; |
|||
concurrencyStamp: string; |
|||
} |
|||
|
|||
export interface IdentityRoleUpdateDto extends IdentityRoleCreateOrUpdateDtoBase { |
|||
concurrencyStamp: string; |
|||
} |
|||
|
|||
export interface IdentityUserCreateDto extends IdentityUserCreateOrUpdateDtoBase { |
|||
password: string; |
|||
} |
|||
|
|||
export interface IdentityUserCreateOrUpdateDtoBase extends ExtensibleObject { |
|||
userName: string; |
|||
name: string; |
|||
surname: string; |
|||
email: string; |
|||
phoneNumber: string; |
|||
twoFactorEnabled: boolean; |
|||
lockoutEnabled: boolean; |
|||
roleNames: string[]; |
|||
} |
|||
|
|||
export interface IdentityUserDto extends ExtensibleFullAuditedEntityDto<string> { |
|||
tenantId?: string; |
|||
userName: string; |
|||
name: string; |
|||
surname: string; |
|||
email: string; |
|||
emailConfirmed: boolean; |
|||
phoneNumber: string; |
|||
phoneNumberConfirmed: boolean; |
|||
twoFactorEnabled: boolean; |
|||
lockoutEnabled: boolean; |
|||
lockoutEnd?: string; |
|||
concurrencyStamp: string; |
|||
} |
|||
|
|||
export interface IdentityUserUpdateDto extends IdentityUserCreateOrUpdateDtoBase { |
|||
password: string; |
|||
concurrencyStamp: string; |
|||
} |
|||
|
|||
export interface IdentityUserUpdateRolesDto { |
|||
roleNames: string[]; |
|||
} |
|||
|
|||
export interface ProfileDto extends ExtensibleObject { |
|||
userName: string; |
|||
email: string; |
|||
name: string; |
|||
surname: string; |
|||
phoneNumber: string; |
|||
isExternal: boolean; |
|||
hasPassword: boolean; |
|||
} |
|||
|
|||
export interface UpdateProfileDto extends ExtensibleObject { |
|||
userName: string; |
|||
email: string; |
|||
name: string; |
|||
surname: string; |
|||
phoneNumber: string; |
|||
} |
|||
|
|||
export interface UserLookupCountInputDto { |
|||
filter: string; |
|||
} |
|||
|
|||
export interface UserLookupSearchInputDto extends PagedAndSortedResultRequestDto { |
|||
filter: string; |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
import type { ChangePasswordInput, ProfileDto, UpdateProfileDto } from './models'; |
|||
import { RestService } from '@abp/ng.core'; |
|||
import { Injectable } from '@angular/core'; |
|||
|
|||
@Injectable({ |
|||
providedIn: 'root', |
|||
}) |
|||
export class ProfileService { |
|||
apiName = 'AbpIdentity'; |
|||
|
|||
changePassword = (input: ChangePasswordInput) => |
|||
this.restService.request<any, void>({ |
|||
method: 'POST', |
|||
url: '/api/identity/my-profile/change-password', |
|||
body: input, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
get = () => |
|||
this.restService.request<any, ProfileDto>({ |
|||
method: 'GET', |
|||
url: '/api/identity/my-profile', |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
update = (input: UpdateProfileDto) => |
|||
this.restService.request<any, ProfileDto>({ |
|||
method: 'PUT', |
|||
url: '/api/identity/my-profile', |
|||
body: input, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
constructor(private restService: RestService) {} |
|||
} |
|||
@ -0,0 +1 @@ |
|||
export * from './models'; |
|||
@ -0,0 +1,12 @@ |
|||
|
|||
export interface UserData { |
|||
id: string; |
|||
tenantId?: string; |
|||
userName: string; |
|||
name: string; |
|||
surname: string; |
|||
email: string; |
|||
emailConfirmed: boolean; |
|||
phoneNumber: string; |
|||
phoneNumberConfirmed: boolean; |
|||
} |
|||
Loading…
Reference in new issue