Commit 43f5ad00 authored by Thomas Frion's avatar Thomas Frion
Browse files

[UPDC] Disable the submit button if the user as nor rigth to update webcams

parent 67eccc07
......@@ -26,7 +26,8 @@
<input type="checkbox" name="" id="active" formControlName="active"><label for="active">Activée</label>
</div>
<div>
<button type="submit">Enregistrer</button>
<button *ngIf='canEditWebcam' type="submit">Enregistrer</button>
<button *ngIf='!canEditWebcam' type="submit" disabled>Enregistrer</button>
</div>
</form>
<div>{{message}}</div>
......
......@@ -8,6 +8,8 @@ import * as popup from '../webcam-management/utils/popup.leaflet';
import { WebcamManagementService } from '../webcam-management/service/webcam-mangement.service';
import { ChoucasApi } from '../pghm-api/choucas/choucas.api.service';
import { WebcamResource } from '../pghm-api/choucas/choucas';
import { PermsManagerService } from '../pghm-api/perms-manager.service';
import { Perms } from '../pghm-api/perm-list';
@Component({
......@@ -23,14 +25,18 @@ export class WebcamEditFormComponent implements OnInit {
author : string = "";
maker : L.Marker;
canEditWebcam : boolean;
private res : WebcamResource;
constructor(
private fb : FormBuilder,
private wcs : WebcamManagementService,
private choucasApi : ChoucasApi,
private perms : PermsManagerService
) {
this.res = new WebcamResource(this.choucasApi);
this.canEditWebcam = this.perms.is_active() && this.perms.is_staff() && this.perms.has_perm(Perms.CHANGE_WEBCAM)
}
/**
......
......@@ -25,7 +25,7 @@ export class WebcamManagementComponent implements OnInit, OnDestroy {
constructor(
private mapService : MapService,
private webcamService : WebcamManagementService,
private overlayssrv : OverlaysManagerService,
private overlayssrv : OverlaysManagerService,
) {
this.mapService.clear();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment