Child-Component-Event und GroupDel
This commit is contained in:
parent
bc1bd6fcbd
commit
4a98164268
|
|
@ -11,6 +11,7 @@ return [
|
|||
# GROUPS
|
||||
['name' => 'group#getagencygroups', 'url' => '/getagencygroups', 'verb' => 'GET'],
|
||||
['name' => 'group#addagencygroup', 'url' => '/addagencygroup', 'verb' => 'PUT'],
|
||||
['name' => 'group#delagencygroup', 'url' => '/delagencygroup/{id}', 'verb' => 'GET'],
|
||||
# DEVELOPMENT
|
||||
['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
|
||||
*
|
||||
* TODO: Check, if logged user has rights to do that!
|
||||
*
|
||||
* @NoAdminRequired
|
||||
*
|
||||
*/
|
||||
#TODO: Check, if logged user has rights to do that!
|
||||
public function addagencygroup(string $groupname){
|
||||
if($groupname == "agencymaingroupid" or preg_match('~[0-9]{6}+~', $groupname) == 1){
|
||||
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>
|
||||
</template>
|
||||
<script>
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
import axios from '@nextcloud/axios'
|
||||
|
||||
export default {
|
||||
name: 'Group',
|
||||
components: {
|
||||
|
|
@ -54,8 +57,12 @@ export default {
|
|||
accordionToggle(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) {
|
||||
console.log(id)
|
||||
this.$confirm({
|
||||
message: 'Möchten Sie die Gruppe ' + this.group.name + ' löschen?',
|
||||
button: {
|
||||
|
|
@ -64,7 +71,7 @@ export default {
|
|||
},
|
||||
callback: confirm => {
|
||||
if (confirm) {
|
||||
console.log('DO IT!')
|
||||
this.delGroupFinal(id)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@
|
|||
:key="index"
|
||||
no-body
|
||||
:index="index"
|
||||
:group="group" />
|
||||
:group="group"
|
||||
@updateGroupData="loadingGroupData()" />
|
||||
</div>
|
||||
<hr>
|
||||
<FormulateForm
|
||||
|
|
@ -65,6 +66,7 @@ export default ({
|
|||
const groupResponse = await axios.get(generateUrl('/apps/agency/getagencygroups'))
|
||||
this.groups = groupResponse.data
|
||||
this.isLoading = true
|
||||
console.log('Some reload happen...')
|
||||
},
|
||||
async submitHandler(data) {
|
||||
const response = await axios.put(generateUrl('/apps/agency/addagencygroup'), data)
|
||||
|
|
|
|||
Loading…
Reference in New Issue