Skip to content

Commit

Permalink
feat(RUP): se verifica permiso al link plantillas
Browse files Browse the repository at this point in the history
  • Loading branch information
maring0019 committed Apr 10, 2023
1 parent 03c9e3c commit 28c32ff
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/app/apps/rup/plantillas-rup/plantillas-rup.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { BehaviorSubject, Observable } from 'rxjs';
import { take } from 'rxjs/operators';
import { PrestacionesService } from '../../../../app/modules/rup/services/prestaciones.service';
import { Auth } from '@andes/auth';
import { Router } from '@angular/router';
@Component({
selector: 'app-plantillas-rup',
templateUrl: './plantillas-rup.component.html',
Expand All @@ -33,6 +34,7 @@ export class PlantillasRUPComponent implements OnInit {
plantillas$: Observable<any> = this.subject.asObservable();
mostrarDescendientes = false;

public puedeCargarEditarPlantilla = false;
addItems = [
{
label: 'Plantilla',
Expand All @@ -55,10 +57,16 @@ export class PlantillasRUPComponent implements OnInit {
private sp: PlantillasService,
private snomedService: SnomedService,
public servicioPrestacion: PrestacionesService,
private router: Router,
private auth: Auth
) { }

ngOnInit() {
this.puedeCargarEditarPlantilla = this.auth.check('rup:plantilla');
// Si no tiene permiso, lo redirige al inicio.
if (!this.puedeCargarEditarPlantilla) {
this.redirect('inicio');
}
this.plex.updateTitle([{
route: '/',
name: 'ANDES'
Expand All @@ -70,6 +78,10 @@ export class PlantillasRUPComponent implements OnInit {
}]);
}

redirect(pagina: string) {
this.router.navigate(['./' + pagina]);
return false;
}
addElementToObservableArray(item) {
this.plantillas$.pipe(take(1)).subscribe(val => {

Expand Down

0 comments on commit 28c32ff

Please sign in to comment.