diff --git a/appinfo/routes.php b/appinfo/routes.php index 14bb5b9..2862e75 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -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'], ] diff --git a/lib/Controller/GroupController.php b/lib/Controller/GroupController.php index 7fe4c31..1e1235d 100644 --- a/lib/Controller/GroupController.php +++ b/lib/Controller/GroupController.php @@ -62,12 +62,12 @@ class GroupController extends Controller { * Creates a new Group by GroupName * * 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; + } } \ No newline at end of file diff --git a/src/components/Group.vue b/src/components/Group.vue index e95d16c..db7c438 100644 --- a/src/components/Group.vue +++ b/src/components/Group.vue @@ -28,6 +28,9 @@