check workflow
This commit is contained in:
parent
358a17e40d
commit
168cfcee46
9 changed files with 1667 additions and 1836 deletions
|
|
@ -80,7 +80,8 @@ export class AppointController extends Controller {
|
||||||
*/
|
*/
|
||||||
@Get("{id}")
|
@Get("{id}")
|
||||||
async GetById(@Request() request: RequestWithUser, @Path() id: string) {
|
async GetById(@Request() request: RequestWithUser, @Path() id: string) {
|
||||||
await new permission().PermissionGet(request, "SYS_PROBATION")
|
let _workflow = await new permission().Workflow(request, id, "SYS_PROBATION")
|
||||||
|
if (_workflow == false) await new permission().PermissionGet(request, "SYS_PROBATION")
|
||||||
|
|
||||||
const appoint = await this.appointRepository.findOne({
|
const appoint = await this.appointRepository.findOne({
|
||||||
select: ["id", "topic", "status", "profileId"],
|
select: ["id", "topic", "status", "profileId"],
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -262,7 +262,8 @@ export class DataOptionController extends Controller {
|
||||||
*/
|
*/
|
||||||
@Get("new-assign")
|
@Get("new-assign")
|
||||||
async NewAssign(@Query() personal_id: string, @Request() request: RequestWithUser) {
|
async NewAssign(@Query() personal_id: string, @Request() request: RequestWithUser) {
|
||||||
await new permission().PermissionGet(request, "SYS_PROBATION")
|
let _workflow = await new permission().Workflow(request, personal_id, "SYS_PROBATION")
|
||||||
|
if (_workflow == false) await new permission().PermissionGet(request, "SYS_PROBATION")
|
||||||
|
|
||||||
const person = await this.personalRepository.findOne({
|
const person = await this.personalRepository.findOne({
|
||||||
select: [
|
select: [
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@ export class EvaluateChairmanController extends Controller {
|
||||||
*/
|
*/
|
||||||
@Get("create")
|
@Get("create")
|
||||||
async CreateEvaluate(@Query() assign_id: string, @Request() request: RequestWithUser) {
|
async CreateEvaluate(@Query() assign_id: string, @Request() request: RequestWithUser) {
|
||||||
await new permission().PermissionGet(request, "SYS_PROBATION")
|
let _workflow = await new permission().Workflow(request, assign_id, "SYS_PROBATION")
|
||||||
|
if (_workflow == false) await new permission().PermissionGet(request, "SYS_PROBATION")
|
||||||
|
|
||||||
const director = await this.assignDirectorRepository.findOne({
|
const director = await this.assignDirectorRepository.findOne({
|
||||||
select: ["personal_id"],
|
select: ["personal_id"],
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@ export class EvaluateController extends Controller {
|
||||||
*/
|
*/
|
||||||
@Get("create")
|
@Get("create")
|
||||||
async CreateEvaluate(@Query() assign_id: string, @Request() request: RequestWithUser) {
|
async CreateEvaluate(@Query() assign_id: string, @Request() request: RequestWithUser) {
|
||||||
await new permission().PermissionGet(request, "SYS_PROBATION")
|
let _workflow = await new permission().Workflow(request, assign_id, "SYS_PROBATION")
|
||||||
|
if (_workflow == false) await new permission().PermissionGet(request, "SYS_PROBATION")
|
||||||
|
|
||||||
const director = await this.assignDirectorRepository.findOne({
|
const director = await this.assignDirectorRepository.findOne({
|
||||||
select: ["personal_id"],
|
select: ["personal_id"],
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -32,7 +32,8 @@ export class EvaluateResultController extends Controller {
|
||||||
*/
|
*/
|
||||||
@Get("create")
|
@Get("create")
|
||||||
async CreateEvaluate(@Query() assign_id: string, @Request() request: RequestWithUser) {
|
async CreateEvaluate(@Query() assign_id: string, @Request() request: RequestWithUser) {
|
||||||
await new permission().PermissionGet(request, "SYS_PROBATION")
|
let _workflow = await new permission().Workflow(request, assign_id, "SYS_PROBATION")
|
||||||
|
if (_workflow == false) await new permission().PermissionGet(request, "SYS_PROBATION")
|
||||||
|
|
||||||
const assign = await this.assignRepository.findOne({
|
const assign = await this.assignRepository.findOne({
|
||||||
relations: ["profile"],
|
relations: ["profile"],
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,8 @@ export class PersonalController extends Controller {
|
||||||
*/
|
*/
|
||||||
@Get("")
|
@Get("")
|
||||||
async GetPersonal(@Request() request: RequestWithUser, @Query() personal_id: string) {
|
async GetPersonal(@Request() request: RequestWithUser, @Query() personal_id: string) {
|
||||||
await new permission().PermissionGet(request, "SYS_PROBATION")
|
let _workflow = await new permission().Workflow(request, personal_id, "SYS_PROBATION")
|
||||||
|
if (_workflow == false) await new permission().PermissionGet(request, "SYS_PROBATION")
|
||||||
const person = await this.personalRepository.findOne({
|
const person = await this.personalRepository.findOne({
|
||||||
where: { personal_id: personal_id },
|
where: { personal_id: personal_id },
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -46,16 +46,6 @@ class CheckAuth {
|
||||||
.GetData(req, `/org/permission/org/${system}/${action}`)
|
.GetData(req, `/org/permission/org/${system}/${action}`)
|
||||||
.then(async x => {
|
.then(async x => {
|
||||||
let privilege = x.privilege
|
let privilege = x.privilege
|
||||||
// if (action.trim().toLocaleUpperCase() == "CREATE")
|
|
||||||
// privilege = await this.PermissionCreate(req, system);
|
|
||||||
// if (action.trim().toLocaleUpperCase() == "DELETE")
|
|
||||||
// privilege = await this.PermissionDelete(req, system);
|
|
||||||
// if (action.trim().toLocaleUpperCase() == "GET")
|
|
||||||
// privilege = await this.PermissionGet(req, system);
|
|
||||||
// if (action.trim().toLocaleUpperCase() == "LIST")
|
|
||||||
// privilege = await this.PermissionList(req, system);
|
|
||||||
// if (action.trim().toLocaleUpperCase() == "UPDATE")
|
|
||||||
// privilege = await this.PermissionUpdate(req, system);
|
|
||||||
|
|
||||||
let data: any = {
|
let data: any = {
|
||||||
root: [null],
|
root: [null],
|
||||||
|
|
@ -132,16 +122,6 @@ class CheckAuth {
|
||||||
.GetData(req, `/org/permission/user/${system}/${action}/${profileId}`)
|
.GetData(req, `/org/permission/user/${system}/${action}/${profileId}`)
|
||||||
.then(async x => {
|
.then(async x => {
|
||||||
let org = x.org
|
let org = x.org
|
||||||
// if (action.trim().toLocaleUpperCase() == "CREATE")
|
|
||||||
// org = await this.PermissionOrgCreate(req, system);
|
|
||||||
// if (action.trim().toLocaleUpperCase() == "DELETE")
|
|
||||||
// org = await this.PermissionOrgDelete(req, system);
|
|
||||||
// if (action.trim().toLocaleUpperCase() == "GET")
|
|
||||||
// org = await this.PermissionOrgGet(req, system);
|
|
||||||
// if (action.trim().toLocaleUpperCase() == "LIST")
|
|
||||||
// org = await this.PermissionOrgList(req, system);
|
|
||||||
// if (action.trim().toLocaleUpperCase() == "UPDATE")
|
|
||||||
// org = await this.PermissionOrgUpdate(req, system);
|
|
||||||
|
|
||||||
if (org.root != null) if (x.orgRootId != org.root[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล"
|
if (org.root != null) if (x.orgRootId != org.root[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล"
|
||||||
if (org.child1 != null) if (x.orgChild1Id != org.child1[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล"
|
if (org.child1 != null) if (x.orgChild1Id != org.child1[0]) throw "ไม่มีสิทธิ์เข้าถึงข้อมูล"
|
||||||
|
|
@ -159,6 +139,22 @@ class CheckAuth {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
public async Workflow(req: RequestWithUser, id: string, sysName: string) {
|
||||||
|
if (req.headers.hasOwnProperty("api_key") && req.headers["api_key"] && req.headers["api_key"] == process.env.API_KEY) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return await new CallAPI()
|
||||||
|
.PostData(req, "/org/workflow/keycloak/isofficer", {
|
||||||
|
refId: id,
|
||||||
|
sysName: sysName,
|
||||||
|
})
|
||||||
|
.then(x => {
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
.catch(x => {
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
}
|
||||||
public async PermissionCreate(req: RequestWithUser, system: string) {
|
public async PermissionCreate(req: RequestWithUser, system: string) {
|
||||||
return await this.Permission(req, system, "CREATE")
|
return await this.Permission(req, system, "CREATE")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue