Child-Component-Event und GroupDel
This commit is contained in:
parent
bc1bd6fcbd
commit
4a98164268
|
|
@ -11,6 +11,7 @@ return [
|
||||||
# GROUPS
|
# GROUPS
|
||||||
['name' => 'group#getagencygroups', 'url' => '/getagencygroups', 'verb' => 'GET'],
|
['name' => 'group#getagencygroups', 'url' => '/getagencygroups', 'verb' => 'GET'],
|
||||||
['name' => 'group#addagencygroup', 'url' => '/addagencygroup', 'verb' => 'PUT'],
|
['name' => 'group#addagencygroup', 'url' => '/addagencygroup', 'verb' => 'PUT'],
|
||||||
|
['name' => 'group#delagencygroup', 'url' => '/delagencygroup/{id}', 'verb' => 'GET'],
|
||||||
# DEVELOPMENT
|
# DEVELOPMENT
|
||||||
['name' => 'test#filetest', 'url' => '/filetest', 'verb' => 'GET'],
|
['name' => 'test#filetest', 'url' => '/filetest', 'verb' => 'GET'],
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -63,11 +63,11 @@ class GroupController extends Controller {
|
||||||
*
|
*
|
||||||
* Not possible are groupnames which are used to seperate the agencys
|
* Not possible are groupnames which are used to seperate the agencys
|
||||||
*
|
*
|
||||||
* TODO: Check, if logged user has rights to do that!
|
|
||||||
*
|
*
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
#TODO: Check, if logged user has rights to do that!
|
||||||
public function addagencygroup(string $groupname){
|
public function addagencygroup(string $groupname){
|
||||||
if($groupname == "agencymaingroupid" or preg_match('~[0-9]{6}+~', $groupname) == 1){
|
if($groupname == "agencymaingroupid" or preg_match('~[0-9]{6}+~', $groupname) == 1){
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -85,4 +85,28 @@ class GroupController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delagencygroup
|
||||||
|
*
|
||||||
|
* Delete an AgencyGroup
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @NoAdminRequired
|
||||||
|
*/
|
||||||
|
public function delagencygroup(string $id){
|
||||||
|
# Getting the Group
|
||||||
|
$todel = $this->groupManager->get($id);
|
||||||
|
|
||||||
|
# Check, that the logged user is in the same Agency!
|
||||||
|
$searchGroupId = $this->agencymanager->getAgencyByUser()->getAgencygid();
|
||||||
|
|
||||||
|
$result = false;
|
||||||
|
# If user is in the same Agency, then delete
|
||||||
|
# TODO: Hier noch einbauen, dass die Rechte geprüft werden!
|
||||||
|
if(str_contains($todel->getGID(), $searchGroupId)) {
|
||||||
|
$todel->delete();
|
||||||
|
$result = true;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -28,6 +28,9 @@
|
||||||
</b-card>
|
</b-card>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import { generateUrl } from '@nextcloud/router'
|
||||||
|
import axios from '@nextcloud/axios'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Group',
|
name: 'Group',
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -54,8 +57,12 @@ export default {
|
||||||
accordionToggle(ele) {
|
accordionToggle(ele) {
|
||||||
this.$root.$emit('bv::toggle::collapse', this.groupDefId + ele)
|
this.$root.$emit('bv::toggle::collapse', this.groupDefId + ele)
|
||||||
},
|
},
|
||||||
|
async delGroupFinal(id) {
|
||||||
|
const r = await axios.get(generateUrl('/apps/agency/delagencygroup/' + this.group.gid))
|
||||||
|
console.log(r)
|
||||||
|
this.$emit('updateGroupData')
|
||||||
|
},
|
||||||
delGroup(id) {
|
delGroup(id) {
|
||||||
console.log(id)
|
|
||||||
this.$confirm({
|
this.$confirm({
|
||||||
message: 'Möchten Sie die Gruppe ' + this.group.name + ' löschen?',
|
message: 'Möchten Sie die Gruppe ' + this.group.name + ' löschen?',
|
||||||
button: {
|
button: {
|
||||||
|
|
@ -64,7 +71,7 @@ export default {
|
||||||
},
|
},
|
||||||
callback: confirm => {
|
callback: confirm => {
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
console.log('DO IT!')
|
this.delGroupFinal(id)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,8 @@
|
||||||
:key="index"
|
:key="index"
|
||||||
no-body
|
no-body
|
||||||
:index="index"
|
:index="index"
|
||||||
:group="group" />
|
:group="group"
|
||||||
|
@updateGroupData="loadingGroupData()" />
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<FormulateForm
|
<FormulateForm
|
||||||
|
|
@ -65,6 +66,7 @@ export default ({
|
||||||
const groupResponse = await axios.get(generateUrl('/apps/agency/getagencygroups'))
|
const groupResponse = await axios.get(generateUrl('/apps/agency/getagencygroups'))
|
||||||
this.groups = groupResponse.data
|
this.groups = groupResponse.data
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
|
console.log('Some reload happen...')
|
||||||
},
|
},
|
||||||
async submitHandler(data) {
|
async submitHandler(data) {
|
||||||
const response = await axios.put(generateUrl('/apps/agency/addagencygroup'), data)
|
const response = await axios.put(generateUrl('/apps/agency/addagencygroup'), data)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue