Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions auth/permisos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,19 @@ export default [
comment: 'Visualiza historias de salud',
avoidAll: true,
child: [
{ key: 'visualizacionHuds', title: 'Visualización HUDS por paciente', type: 'boolean' },
{ key: 'visualizacionHuds', title: 'Ver HUDS completa', type: 'boolean' },
{ key: 'soloEfectorActual', title: 'Visualizar HUDS solo de prestaciones realizadas en el efector actual', type: 'boolean' },
{ key: 'impresion', title: 'Imprimir cualquier prestación', type: 'boolean', visibility: 'restricted' },
{ key: 'exportarHuds', title: 'Exportar HUDS de un paciente', type: 'boolean', visibility: 'restricted' }
{ key: 'exportarHuds', title: 'Exportar HUDS de un paciente', type: 'boolean', visibility: 'restricted' },
{
key: 'visualizacionParcialHuds',
title: 'Visualización parcial de la HUDS',
child: [
{ key: 'laboratorio', title: 'Ver solo laboratorios', type: 'boolean' },
{ key: 'vacuna', title: 'Ver solo vacunas', type: 'boolean' },
{ key: 'receta', title: 'Ver solo recetas', type: 'boolean' }
]
}
]
},
{
Expand Down
8 changes: 7 additions & 1 deletion modules/recetas/recetas.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ export const RecetasCtr = new RecetasResource({});
export const RecetasRouter = RecetasCtr.makeRoutes();

const authorizeByToken = async (req: Request, res: Response, next) =>
Auth.authorizeByToken(req, res, next, ['huds:visualizacionHuds', 'recetas:read']);
Auth.authorizeByToken(req, res, next, [
'huds:visualizacionHuds',
'huds:visualizacionParcialHuds:laboratorio',
'huds:visualizacionParcialHuds:vacuna',
'huds:visualizacionParcialHuds:receta',
'huds:visualizacionParcialHuds:*',
'recetas:read']);

RecetasRouter.use(Auth.authenticate());
RecetasRouter.get('/recetas', authorizeByToken, asyncHandler(get));
Expand Down