institucion endpoints restringidos a usuario
This commit is contained in:
@@ -43,7 +43,7 @@ export class InstitucionProgramaController {
|
||||
create(@Request() req, @Body() body: CreateProgramaDto) {
|
||||
const superAdmin: Operador = req.user.operador;
|
||||
|
||||
if (superAdmin.tipoUsuario.id_tipo_usuario != 2)
|
||||
if (!superAdmin || superAdmin.tipoUsuario.id_tipo_usuario != 2)
|
||||
throw new ConflictException('No tienes permiso de realizar esta acción.');
|
||||
return this.institucionProgramaService.create(body.programa);
|
||||
}
|
||||
@@ -111,7 +111,7 @@ export class InstitucionProgramaController {
|
||||
update(@Request() req, @Body() body: UpdateProgramaDto) {
|
||||
const admin: Operador = req.user.operador;
|
||||
|
||||
if (admin.tipoUsuario.id_tipo_usuario != 3)
|
||||
if (!admin || admin.tipoUsuario.id_tipo_usuario != 3)
|
||||
throw new ConflictException('No tienes permiso de realizar esta acción.');
|
||||
return this.institucionProgramaService.update(admin, body);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user