tests
This commit is contained in:
parent
69cd61db9e
commit
2760850c63
|
|
@ -79,7 +79,14 @@ class AgencyController extends Controller {
|
||||||
*/
|
*/
|
||||||
public function update(int $id, string $name, string $inhaber, string $street, string $plz, string $city, string $agencymail, string $phone) {
|
public function update(int $id, string $name, string $inhaber, string $street, string $plz, string $city, string $agencymail, string $phone) {
|
||||||
return $this->handleNotFound(function () use ($id, $name, $inhaber, $street, $plz, $city, $agencymail, $phone) {
|
return $this->handleNotFound(function () use ($id, $name, $inhaber, $street, $plz, $city, $agencymail, $phone) {
|
||||||
return $this->service->update($id, $name, $inhaber, $street, $plz, $city, $agencymail, $phone);
|
# TODO: ABfrage machen!
|
||||||
|
if($this->agencyuserservice->checkAgencyIdUserId($this->userSession->getUser()->getUid(), $id)){
|
||||||
|
return $this->service->update($id, $name, $inhaber, $street, $plz, $city, $agencymail, $phone);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class AgencyUserService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Find an Agency
|
//Find an Agency-User
|
||||||
public function find(int $id) {
|
public function find(int $id) {
|
||||||
try {
|
try {
|
||||||
return $this->mapper->find($id);
|
return $this->mapper->find($id);
|
||||||
|
|
@ -36,13 +36,18 @@ class AgencyUserService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Find an Agency
|
//Find an Agency-User
|
||||||
public function getAgencyIdByUserUid(string $useruid) {
|
public function getAgencyIdByUserUid(string $useruid) {
|
||||||
return $this->mapper->getAgencyIdByUserUid($useruid);
|
try {
|
||||||
//try {
|
return $this->mapper->getAgencyIdByUserUid($useruid);
|
||||||
// return $this->mapper->getAgencyIdByUserUid($useruid);
|
} catch(Exception $e) {
|
||||||
//} catch(Exception $e) {
|
$this->handleException($e);
|
||||||
// $this->handleException($e);
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
|
//Checks, if a given User is in given Agency. Use for secure reason to make save, that agencydata is only changed by user which belongs to that agency.
|
||||||
|
public function checkAgencyIdUserId(string $useruid, int $agencyid){
|
||||||
|
# TODO: Hier einmal prüfen, dass der eingeloggte Nutzer auch zur angefragten Agentur passt!
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -10174,6 +10174,11 @@
|
||||||
"date-format-parse": "0.2.6"
|
"date-format-parse": "0.2.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"vuex": {
|
||||||
|
"version": "3.6.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz",
|
||||||
|
"integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw=="
|
||||||
|
},
|
||||||
"watchpack": {
|
"watchpack": {
|
||||||
"version": "1.7.5",
|
"version": "1.7.5",
|
||||||
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz",
|
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz",
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,8 @@
|
||||||
"bootstrap": "^5.0.1",
|
"bootstrap": "^5.0.1",
|
||||||
"bootstrap-vue": "^2.21.2",
|
"bootstrap-vue": "^2.21.2",
|
||||||
"vue": "^2.6.12",
|
"vue": "^2.6.12",
|
||||||
"vue-router": "^3.5.1"
|
"vue-router": "^3.5.1",
|
||||||
|
"vuex": "^3.6.2"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"extends @nextcloud/browserslist-config"
|
"extends @nextcloud/browserslist-config"
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { de } from '@braid/vue-formulate-i18n'
|
||||||
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
|
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
|
||||||
import 'bootstrap/dist/css/bootstrap.css'
|
import 'bootstrap/dist/css/bootstrap.css'
|
||||||
import 'bootstrap-vue/dist/bootstrap-vue.css'
|
import 'bootstrap-vue/dist/bootstrap-vue.css'
|
||||||
|
import store from './store'
|
||||||
|
|
||||||
Vue.use(VueRouter)
|
Vue.use(VueRouter)
|
||||||
Vue.use(VueFormulate, {
|
Vue.use(VueFormulate, {
|
||||||
|
|
@ -24,5 +25,6 @@ const router = new VueRouter({
|
||||||
export default new Vue({
|
export default new Vue({
|
||||||
el: '#content',
|
el: '#content',
|
||||||
router,
|
router,
|
||||||
|
store,
|
||||||
render: h => h(App),
|
render: h => h(App),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
import Vue from 'vue'
|
||||||
|
import Vuex from 'vuex'
|
||||||
|
import { generateUrl } from '@nextcloud/router'
|
||||||
|
const axios = require('axios').default
|
||||||
|
|
||||||
|
Vue.use(Vuex)
|
||||||
|
|
||||||
|
export default new Vuex.Store({
|
||||||
|
state: {
|
||||||
|
agencyId: null,
|
||||||
|
agency: null,
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
getAgencyId(state) {
|
||||||
|
return state.agencyId
|
||||||
|
},
|
||||||
|
setAgencyId(state, id) {
|
||||||
|
state.agencyId = id
|
||||||
|
},
|
||||||
|
getAgency(state) {
|
||||||
|
return state.agency
|
||||||
|
},
|
||||||
|
setAgency(state, agency) {
|
||||||
|
state.agency = agency
|
||||||
|
},
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
loadAgencyData({ commit }) {
|
||||||
|
// axios.get(generateUrl('/apps/agency/getagencyidbyuser')).then(response => {
|
||||||
|
// console.log('Here we load...')
|
||||||
|
// this.agencyId = response.data.agency
|
||||||
|
// }) + this.$store.state.agencyId
|
||||||
|
const agencydata = axios.get(generateUrl('/apps/agency/agencys/4')).then(function() {
|
||||||
|
commit('setAgency', agencydata.data)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
</b-row>
|
</b-row>
|
||||||
</FormulateForm>
|
</FormulateForm>
|
||||||
</b-container>
|
</b-container>
|
||||||
<b-container v-if="!isLoading" class="mx-auto">
|
<b-container v-if="!isLoading" class="d-flex justify-content-center">
|
||||||
<b-spinner type="grow" />
|
<b-spinner type="grow" />
|
||||||
</b-container>
|
</b-container>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
@ -77,7 +77,6 @@
|
||||||
<script>
|
<script>
|
||||||
import Content from '@nextcloud/vue/dist/Components/Content'
|
import Content from '@nextcloud/vue/dist/Components/Content'
|
||||||
import { generateUrl } from '@nextcloud/router'
|
import { generateUrl } from '@nextcloud/router'
|
||||||
import '@braid/vue-formulate/themes/snow/snow.scss'
|
|
||||||
const axios = require('axios').default
|
const axios = require('axios').default
|
||||||
|
|
||||||
export default ({
|
export default ({
|
||||||
|
|
@ -87,24 +86,29 @@ export default ({
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
agency: null,
|
agency: this.$store.agency,
|
||||||
agencyid: null,
|
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.fetchData()
|
this.loadInitialData()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async fetchData() {
|
async loadInitialData() {
|
||||||
const agencyidresp = await axios.get(generateUrl('/apps/agency/getagencyidbyuser'))
|
// await this.$store.dispatch('loadAgencyData') {
|
||||||
this.agencyid = agencyidresp.data.agency
|
// console.log('Done!')
|
||||||
const agencydata = await axios.get(generateUrl('/apps/agency/agencys/' + this.agencyid))
|
// console.log(this.$store.state)
|
||||||
this.agency = agencydata.data
|
// }
|
||||||
this.isLoading = true
|
console.log('Loading something')
|
||||||
|
},
|
||||||
|
async loadingAgencyData() {
|
||||||
|
// const agencydata = await axios.get(generateUrl('/apps/agency/agencys/' + this.$store.state.agencyId))
|
||||||
|
// this.agency = agencydata.data
|
||||||
|
// this.isLoading = true
|
||||||
|
console.log('Now loading AgencyData')
|
||||||
},
|
},
|
||||||
async submitHandler(data) {
|
async submitHandler(data) {
|
||||||
const response = await axios.put(generateUrl('/apps/agency/agencys/' + this.agencyid), data)
|
const response = await axios.put(generateUrl('/apps/agency/agencys/' + this.$store.state.agencyid), data)
|
||||||
console.log(response)
|
console.log(response)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<Content app-name="GroupManagement">
|
<Content app-name="GroupManagement">
|
||||||
<b-container class="bv-example-row">
|
<b-container class="bv-example-row">
|
||||||
<h3>Gruppenverwaltung</h3>
|
<h3>Gruppenverwaltung in Echt jetzt!</h3>
|
||||||
</b-container>
|
</b-container>
|
||||||
</Content>
|
</Content>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import Content from '@nextcloud/vue/dist/Components/Content'
|
import Content from '@nextcloud/vue/dist/Components/Content'
|
||||||
import '@braid/vue-formulate/themes/snow/snow.scss'
|
// import '@braid/vue-formulate/themes/snow/snow.scss'
|
||||||
// import { generateUrl } from '@nextcloud/router'
|
// import { generateUrl } from '@nextcloud/router'
|
||||||
// const axios = require('axios').default
|
// const axios = require('axios').default
|
||||||
|
|
||||||
|
|
@ -18,6 +18,7 @@ export default ({
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
groups: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue