super_admin unvalidate

This commit is contained in:
AdisakKanthawilang 2024-08-20 13:37:41 +07:00
parent 99255ff36b
commit e312e43eaa

View file

@ -589,12 +589,24 @@ export class OrganizationController extends Controller {
*/ */
@Get("{id}") @Get("{id}")
async detail(@Path() id: string, @Request() request: RequestWithUser) { async detail(@Path() id: string, @Request() request: RequestWithUser) {
let _data = {
root: null,
child1: null,
child2: null,
child3: null,
child4: null,
}
if (!request.user.role.includes('SUPER_ADMIN')) {
console.log("none super_admin");
_data = await new permission().PermissionOrgList(request, "SYS_ORG");
}
const orgRevision = await this.orgRevisionRepository.findOne({ where: { id } }); const orgRevision = await this.orgRevisionRepository.findOne({ where: { id } });
if (!orgRevision) { if (!orgRevision) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
} }
let _data = await new permission().PermissionOrgList(request, "SYS_ORG");
const orgRootData = await AppDataSource.getRepository(OrgRoot) const orgRootData = await AppDataSource.getRepository(OrgRoot)
.createQueryBuilder("orgRoot") .createQueryBuilder("orgRoot")
.where("orgRoot.orgRevisionId = :id", { id }) .where("orgRoot.orgRevisionId = :id", { id })