mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
new method to delete group
This commit is contained in:
parent
dbb9381573
commit
1133d65544
|
@ -2201,6 +2201,25 @@ class RestapiController { /* {{{ */
|
|||
return $response->withJson(array('success'=>true, 'message'=>'', 'data'=>$this->__getGroupData($newGroup)), 201);
|
||||
} /* }}} */
|
||||
|
||||
function deleteGroup($request, $response, $args) { /* {{{ */
|
||||
$dms = $this->container->dms;
|
||||
$userobj = $this->container->userobj;
|
||||
|
||||
$check = $this->checkIfAdmin($request, $response);
|
||||
if($check !== true)
|
||||
return $check;
|
||||
|
||||
if($group = $dms->getGroup($args['id'])) {
|
||||
if($result = $group->remove($userobj)) {
|
||||
return $response->withJson(array('success'=>$result, 'message'=>'', 'data'=>''), 200);
|
||||
} else {
|
||||
return $response->withJson(array('success'=>$result, 'message'=>'Could not delete group', 'data'=>''), 500);
|
||||
}
|
||||
} else {
|
||||
return $response->withJson(array('success'=>false, 'message'=>'No such group', 'data'=>''), 404);
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
function getGroup($request, $response, $args) { /* {{{ */
|
||||
$dms = $this->container->dms;
|
||||
$userobj = $this->container->userobj;
|
||||
|
@ -2869,6 +2888,7 @@ $app->put('/users/{id}/disable', \RestapiController::class.':setDisabledUser');
|
|||
$app->put('/users/{id}/password', \RestapiController::class.':changeUserPassword');
|
||||
$app->post('/groups', \RestapiController::class.':createGroup');
|
||||
$app->get('/groups', \RestapiController::class.':getGroups');
|
||||
$app->delete('/groups/{id}', \RestapiController::class.':deleteGroup');
|
||||
$app->get('/groups/{id}', \RestapiController::class.':getGroup');
|
||||
$app->put('/groups/{id}/addUser', \RestapiController::class.':addUserToGroup');
|
||||
$app->put('/groups/{id}/removeUser', \RestapiController::class.':removeUserFromGroup');
|
||||
|
|
Loading…
Reference in New Issue
Block a user