Vérification des droits d'admin pour ajouter
avions/dz/type de sauts
This commit is contained in:
@@ -18,14 +18,10 @@ export class AppComponent implements OnInit {
|
||||
public currentUser: User;
|
||||
public version: string;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private authenticationService: AuthenticationService,
|
||||
private serviceComm: ServiceComm
|
||||
) {
|
||||
this.authenticationService.currentUser.subscribe(
|
||||
x => (this.currentUser = x)
|
||||
);
|
||||
constructor(private router: Router,
|
||||
private authenticationService: AuthenticationService,
|
||||
private serviceComm: ServiceComm) {
|
||||
this.authenticationService.currentUser.subscribe(user => { this.currentUser = user; });
|
||||
|
||||
ConfigurationHelper.settings.subscribe(settings =>
|
||||
{
|
||||
|
||||
@@ -68,42 +68,42 @@ const appRoutes: Routes = [
|
||||
{
|
||||
path: "summary",
|
||||
component: SummaryComponent,
|
||||
canActivate: [AuthGuardService],
|
||||
canActivate: [AuthGuardService]
|
||||
},
|
||||
{
|
||||
path: "jumps",
|
||||
component: ListOfJumpsComponent,
|
||||
canActivate: [AuthGuardService],
|
||||
canActivate: [AuthGuardService]
|
||||
},
|
||||
{
|
||||
path: "dzs",
|
||||
component: ListOfDzsComponent,
|
||||
canActivate: [AuthGuardService],
|
||||
canActivate: [AuthGuardService]
|
||||
},
|
||||
{
|
||||
path: "newjump",
|
||||
component: NewJumpComponent,
|
||||
canActivate: [AuthGuardService],
|
||||
canActivate: [AuthGuardService]
|
||||
},
|
||||
{
|
||||
path: "aircrafts",
|
||||
component: ListOfAircraftsComponent,
|
||||
canActivate: [AuthGuardService],
|
||||
canActivate: [AuthGuardService]
|
||||
},
|
||||
{
|
||||
path: "jumpTypes",
|
||||
component: ListOfJumpTypesComponent,
|
||||
canActivate: [AuthGuardService],
|
||||
canActivate: [AuthGuardService]
|
||||
},
|
||||
{
|
||||
path: "gears",
|
||||
component: ListOfGearsComponent,
|
||||
canActivate: [AuthGuardService],
|
||||
canActivate: [AuthGuardService]
|
||||
},
|
||||
{
|
||||
path: "user",
|
||||
component: UserProfileComponent,
|
||||
canActivate: [AuthGuardService],
|
||||
canActivate: [AuthGuardService]
|
||||
},
|
||||
|
||||
{ path: "login", component: LoginComponent },
|
||||
|
||||
@@ -58,7 +58,6 @@ export class CreateUserComponent implements OnInit {
|
||||
this.invalidForm = false;
|
||||
this.submitted = true;
|
||||
|
||||
// stop here if form is invalid
|
||||
if (this.createForm.invalid) {
|
||||
this.invalidForm = true;
|
||||
return;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="content">
|
||||
<div *ngIf="dataSourceTable != null else loading">
|
||||
<button mat-raised-button color="accent" (click)="openDialogToAdd()">Add a aircraft</button>
|
||||
<button mat-raised-button color="accent" (click)="openDialogToAdd()" *ngIf="isUserAdmin == true">Add a aircraft</button>
|
||||
|
||||
<table mat-table [dataSource]="dataSourceTable">
|
||||
<ng-container matColumnDef="id">
|
||||
|
||||
@@ -3,11 +3,12 @@ import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
import { AircraftResp } from '../../models/aircraft';
|
||||
import { AircraftService } from '../../services/aircraft.service';
|
||||
import { ServiceComm } from '../../services/service-comm.service';
|
||||
import { AuthenticationService } from '../../services/authentication.service';
|
||||
import { NewAircraftComponent } from '../new-aircraft/new-aircraft.component';
|
||||
import { AddAction } from '../../models/add-action.enum';
|
||||
import { AircraftResp } from '../../models/aircraft';
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-of-aircrafts',
|
||||
@@ -18,13 +19,15 @@ export class ListOfAircraftsComponent implements OnInit {
|
||||
public displayedColumns: Array<string> = ['id', 'name', 'imageData'];
|
||||
public dataSourceTable: MatTableDataSource<AircraftResp>;
|
||||
public resultsLength = 0;
|
||||
public isUserAdmin: boolean;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
|
||||
constructor(
|
||||
private serviceApi: AircraftService,
|
||||
private serviceComm: ServiceComm,
|
||||
public dialog: MatDialog
|
||||
) { }
|
||||
constructor(private serviceApi: AircraftService,
|
||||
private serviceComm: ServiceComm,
|
||||
private authenticationService: AuthenticationService,
|
||||
public dialog: MatDialog) {
|
||||
this.isUserAdmin = this.authenticationService.currentUserValue.IsAdmin;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.refreshRequest.subscribe(action => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="content">
|
||||
<div *ngIf="dataSourceTable != null else loading">
|
||||
<button mat-raised-button color="accent" (click)="openDialogToAdd()">Add a drop zone</button>
|
||||
<button mat-raised-button color="accent" (click)="openDialogToAdd()" *ngIf="isUserAdmin == true">Add a drop zone</button>
|
||||
|
||||
<table mat-table [dataSource]="dataSourceTable">
|
||||
<ng-container matColumnDef="isfavorite">
|
||||
|
||||
@@ -7,6 +7,7 @@ import { AddAction } from '../../models/add-action.enum';
|
||||
import { DropZoneResp } from '../../models/dropzone';
|
||||
import { DropzoneService } from '../../services/dropzone.service';
|
||||
import { ServiceComm } from '../../services/service-comm.service';
|
||||
import { AuthenticationService } from '../../services/authentication.service';
|
||||
import { NewDropZoneComponent } from '../new-drop-zone/new-drop-zone.component';
|
||||
|
||||
@Component({
|
||||
@@ -23,14 +24,16 @@ export class ListOfDzsComponent implements OnInit {
|
||||
'type',
|
||||
];
|
||||
public dataSourceTable: MatTableDataSource<DropZoneResp>;
|
||||
public isUserAdmin: boolean;
|
||||
public resultsLength = 0;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
|
||||
constructor(
|
||||
private serviceApi: DropzoneService,
|
||||
private serviceComm: ServiceComm,
|
||||
public dialog: MatDialog
|
||||
) { }
|
||||
constructor(private serviceApi: DropzoneService,
|
||||
private serviceComm: ServiceComm,
|
||||
private authenticationService: AuthenticationService,
|
||||
public dialog: MatDialog) {
|
||||
this.isUserAdmin = this.authenticationService.currentUserValue.IsAdmin;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.refreshRequest.subscribe((action) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="content">
|
||||
<div *ngIf="dataSourceTable != null else loading">
|
||||
<button mat-raised-button color="accent" (click)="openDialogToAdd()">Add a jump type</button>
|
||||
<button mat-raised-button color="accent" (click)="openDialogToAdd()" *ngIf="isUserAdmin == true">Add a jump type</button>
|
||||
|
||||
<table mat-table [dataSource]="dataSourceTable">
|
||||
<ng-container matColumnDef="id">
|
||||
|
||||
@@ -7,6 +7,7 @@ import { AddAction } from "../../models/add-action.enum";
|
||||
import { JumpTypeResp } from "../../models/jumpType";
|
||||
import { JumpTypeService } from "../../services/jump-type.service";
|
||||
import { ServiceComm } from "../../services/service-comm.service";
|
||||
import { AuthenticationService } from '../../services/authentication.service';
|
||||
import { NewJumpTypeComponent } from "../new-jump-type/new-jump-type.component";
|
||||
|
||||
@Component({
|
||||
@@ -17,14 +18,16 @@ import { NewJumpTypeComponent } from "../new-jump-type/new-jump-type.component";
|
||||
export class ListOfJumpTypesComponent implements OnInit {
|
||||
public displayedColumns: Array<string> = ["id", "name"];
|
||||
public dataSourceTable: MatTableDataSource<JumpTypeResp>;
|
||||
public isUserAdmin: boolean;
|
||||
public resultsLength = 0;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
|
||||
constructor(
|
||||
private serviceApi: JumpTypeService,
|
||||
private serviceComm: ServiceComm,
|
||||
public dialog: MatDialog
|
||||
) {}
|
||||
constructor(private serviceApi: JumpTypeService,
|
||||
private serviceComm: ServiceComm,
|
||||
private authenticationService: AuthenticationService,
|
||||
public dialog: MatDialog) {
|
||||
this.isUserAdmin = this.authenticationService.currentUserValue.IsAdmin;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.refreshRequest.subscribe(action => {
|
||||
|
||||
@@ -43,7 +43,7 @@ export class LoginUserComponent implements OnInit, AfterViewInit {
|
||||
password: [
|
||||
'',
|
||||
[
|
||||
Validators.required /*, Validators.pattern("^[A-Za-z0-9_-]{8,15}$")*/
|
||||
Validators.required
|
||||
]
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user