fix keyclock function
This commit is contained in:
parent
cb0a3e2f38
commit
2648c5b5fa
3 changed files with 15 additions and 8 deletions
|
|
@ -73,7 +73,8 @@ export class ProfileAbilityEmployeeTempController extends Controller {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
public async detailProfileAbility(@Path() profileEmployeeId: string) {
|
public async detailProfileAbility(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||||
|
await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_TEMP", profileEmployeeId);
|
||||||
const getProfileAbilityId = await this.profileAbilityRepo.findBy({ profileEmployeeId });
|
const getProfileAbilityId = await this.profileAbilityRepo.findBy({ profileEmployeeId });
|
||||||
if (!getProfileAbilityId) {
|
if (!getProfileAbilityId) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
@ -120,7 +121,12 @@ export class ProfileAbilityEmployeeTempController extends Controller {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
public async getProfileAbilityHistory(@Path() abilityId: string) {
|
public async getProfileAbilityHistory(@Path() abilityId: string, @Request() req: RequestWithUser) {
|
||||||
|
const _record = await this.profileAbilityRepo.findOneBy({ id: abilityId });
|
||||||
|
if (_record) {
|
||||||
|
await new permission().PermissionOrgUserDelete(req, "SYS_REGISTRY_TEMP", _record.profileEmployeeId);
|
||||||
|
}
|
||||||
|
|
||||||
const record = await this.profileAbilityHistoryRepo.findBy({
|
const record = await this.profileAbilityHistoryRepo.findBy({
|
||||||
profileAbilityId: abilityId,
|
profileAbilityId: abilityId,
|
||||||
});
|
});
|
||||||
|
|
@ -135,7 +141,6 @@ export class ProfileAbilityEmployeeTempController extends Controller {
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
@Body() body: CreateProfileAbilityEmployee,
|
@Body() body: CreateProfileAbilityEmployee,
|
||||||
) {
|
) {
|
||||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
|
||||||
if (!body.profileEmployeeId) {
|
if (!body.profileEmployeeId) {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId");
|
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId");
|
||||||
}
|
}
|
||||||
|
|
@ -144,6 +149,7 @@ export class ProfileAbilityEmployeeTempController extends Controller {
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||||
}
|
}
|
||||||
|
await new permission().PermissionOrgUserCreate(req, "SYS_REGISTRY_TEMP", profile.id);
|
||||||
|
|
||||||
const data = new ProfileAbility();
|
const data = new ProfileAbility();
|
||||||
const meta = {
|
const meta = {
|
||||||
|
|
@ -170,9 +176,9 @@ export class ProfileAbilityEmployeeTempController extends Controller {
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
@Path() abilityId: string,
|
@Path() abilityId: string,
|
||||||
) {
|
) {
|
||||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
|
||||||
const record = await this.profileAbilityRepo.findOneBy({ id: abilityId });
|
const record = await this.profileAbilityRepo.findOneBy({ id: abilityId });
|
||||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_TEMP", record.profileEmployeeId)
|
||||||
|
|
||||||
const history = new ProfileAbilityHistory();
|
const history = new ProfileAbilityHistory();
|
||||||
|
|
||||||
|
|
@ -197,7 +203,11 @@ export class ProfileAbilityEmployeeTempController extends Controller {
|
||||||
|
|
||||||
@Delete("{abilityId}")
|
@Delete("{abilityId}")
|
||||||
public async deleteProfileAbility(@Path() abilityId: string, @Request() req: RequestWithUser) {
|
public async deleteProfileAbility(@Path() abilityId: string, @Request() req: RequestWithUser) {
|
||||||
await new permission().PermissionDelete(req, "SYS_REGISTRY_TEMP");
|
const _record = await this.profileAbilityRepo.findOneBy({ id: abilityId });
|
||||||
|
if (_record) {
|
||||||
|
await new permission().PermissionOrgUserDelete(req, "SYS_REGISTRY_TEMP", _record.profileEmployeeId);
|
||||||
|
}
|
||||||
|
|
||||||
await this.profileAbilityHistoryRepo.delete({
|
await this.profileAbilityHistoryRepo.delete({
|
||||||
profileAbilityId: abilityId,
|
profileAbilityId: abilityId,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -4735,7 +4735,6 @@ export class ProfileController extends Controller {
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
|
||||||
}
|
}
|
||||||
await new permission().PermissionOrgUserList(request, "SYS_REGISTRY_OFFICER", profile.id);
|
|
||||||
|
|
||||||
const posMaster = await this.posMasterRepo.findOne({
|
const posMaster = await this.posMasterRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
|
|
|
||||||
|
|
@ -2560,7 +2560,6 @@ export class ProfileEmployeeController extends Controller {
|
||||||
@Get("keycloak/position/{revisionId}")
|
@Get("keycloak/position/{revisionId}")
|
||||||
async getProfileByKeycloakByRevision(
|
async getProfileByKeycloakByRevision(
|
||||||
@Path() revisionId: string,
|
@Path() revisionId: string,
|
||||||
@Path() req: RequestWithUser,
|
|
||||||
@Request() request: { user: Record<string, any> },
|
@Request() request: { user: Record<string, any> },
|
||||||
) {
|
) {
|
||||||
const profile = await this.profileRepo.findOne({
|
const profile = await this.profileRepo.findOne({
|
||||||
|
|
@ -2570,7 +2569,6 @@ export class ProfileEmployeeController extends Controller {
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
|
||||||
}
|
}
|
||||||
await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profile.id)
|
|
||||||
const _profile = {
|
const _profile = {
|
||||||
profileId: profile.id,
|
profileId: profile.id,
|
||||||
rank: profile.rank,
|
rank: profile.rank,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue