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) {
|
||||
return $this->handleNotFound(function () use ($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) {
|
||||
try {
|
||||
return $this->mapper->find($id);
|
||||
|
|
@ -36,13 +36,18 @@ class AgencyUserService {
|
|||
}
|
||||
}
|
||||
|
||||
//Find an Agency
|
||||
//Find an Agency-User
|
||||
public function getAgencyIdByUserUid(string $useruid) {
|
||||
try {
|
||||
return $this->mapper->getAgencyIdByUserUid($useruid);
|
||||
//try {
|
||||
// return $this->mapper->getAgencyIdByUserUid($useruid);
|
||||
//} catch(Exception $e) {
|
||||
// $this->handleException($e);
|
||||
//}
|
||||
} catch(Exception $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"
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"version": "1.7.5",
|
||||
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.5.tgz",
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@
|
|||
"bootstrap": "^5.0.1",
|
||||
"bootstrap-vue": "^2.21.2",
|
||||
"vue": "^2.6.12",
|
||||
"vue-router": "^3.5.1"
|
||||
"vue-router": "^3.5.1",
|
||||
"vuex": "^3.6.2"
|
||||
},
|
||||
"browserslist": [
|
||||
"extends @nextcloud/browserslist-config"
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { de } from '@braid/vue-formulate-i18n'
|
|||
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
|
||||
import 'bootstrap/dist/css/bootstrap.css'
|
||||
import 'bootstrap-vue/dist/bootstrap-vue.css'
|
||||
import store from './store'
|
||||
|
||||
Vue.use(VueRouter)
|
||||
Vue.use(VueFormulate, {
|
||||
|
|
@ -24,5 +25,6 @@ const router = new VueRouter({
|
|||
export default new Vue({
|
||||
el: '#content',
|
||||
router,
|
||||
store,
|
||||
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>
|
||||
</FormulateForm>
|
||||
</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-container>
|
||||
</Content>
|
||||
|
|
@ -77,7 +77,6 @@
|
|||
<script>
|
||||
import Content from '@nextcloud/vue/dist/Components/Content'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
import '@braid/vue-formulate/themes/snow/snow.scss'
|
||||
const axios = require('axios').default
|
||||
|
||||
export default ({
|
||||
|
|
@ -87,24 +86,29 @@ export default ({
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
agency: null,
|
||||
agencyid: null,
|
||||
agency: this.$store.agency,
|
||||
isLoading: false,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
this.loadInitialData()
|
||||
},
|
||||
methods: {
|
||||
async fetchData() {
|
||||
const agencyidresp = await axios.get(generateUrl('/apps/agency/getagencyidbyuser'))
|
||||
this.agencyid = agencyidresp.data.agency
|
||||
const agencydata = await axios.get(generateUrl('/apps/agency/agencys/' + this.agencyid))
|
||||
this.agency = agencydata.data
|
||||
this.isLoading = true
|
||||
async loadInitialData() {
|
||||
// await this.$store.dispatch('loadAgencyData') {
|
||||
// console.log('Done!')
|
||||
// console.log(this.$store.state)
|
||||
// }
|
||||
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) {
|
||||
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)
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
<template>
|
||||
<Content app-name="GroupManagement">
|
||||
<b-container class="bv-example-row">
|
||||
<h3>Gruppenverwaltung</h3>
|
||||
<h3>Gruppenverwaltung in Echt jetzt!</h3>
|
||||
</b-container>
|
||||
</Content>
|
||||
</template>
|
||||
<script>
|
||||
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'
|
||||
// const axios = require('axios').default
|
||||
|
||||
|
|
@ -18,6 +18,7 @@ export default ({
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
groups: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue