# HG changeset patch # User Thomas Junk # Date 1560936434 -7200 # Node ID 2d77a7447d0905f63981d33fe2ac01aefafa8fe5 # Parent a925e4e323a8068adebd1ff5085b0eb26dad3add import_soundingresult: restrict users to import only data for bottlenecks they are responsible for diff -r a925e4e323a8 -r 2d77a7447d09 client/src/components/importconfiguration/types/Soundingresults.vue --- a/client/src/components/importconfiguration/types/Soundingresults.vue Wed Jun 19 11:24:30 2019 +0200 +++ b/client/src/components/importconfiguration/types/Soundingresults.vue Wed Jun 19 11:27:14 2019 +0200 @@ -201,7 +201,7 @@ */ import { HTTP } from "@/lib/http"; import { displayError, displayInfo } from "@/lib/errors"; -import { mapState } from "vuex"; +import { mapState, mapGetters } from "vuex"; const IMPORTSTATE = { UPLOAD: "UPLOAD", EDIT: "EDIT" }; @@ -351,6 +351,8 @@ computed: { ...mapState("application", ["showContextBox"]), ...mapState("bottlenecks", ["bottlenecks"]), + ...mapState("user", ["user"]), + ...mapGetters("usermanagement", ["userCountries"]), importSoundingresultsLabel() { return this.$gettext("Import Soundingresults"); }, @@ -366,7 +368,11 @@ return this.disableUpload; }, availableBottlenecks() { - return this.bottlenecks; + const userCountrycode = this.userCountries[this.user]; + if (userCountrycode === "global") return this.bottlenecks; + return this.bottlenecks.filter( + bn => bn.properties.responsible_country === userCountrycode + ); }, placeholder() { return this.$gettext("Select bottleneck");