setting quota and homefolder returns the updated account

This commit is contained in:
Uwe Steinmann 2025-02-06 11:18:01 +01:00
parent 4e39c69224
commit c940162328

View File

@ -2264,7 +2264,8 @@ final class SeedDMS_RestapiController { /* {{{ */
return $this->renderer->json($response, array('success'=>false, 'message'=>'', 'data'=>'Could not change quota.'))->withStatus(404);
}
return $this->renderer->json($response, array('success'=>true, 'message'=>'', 'data'=>''))->withStatus(200);
$data = $this->__getUserData($account);
return $this->renderer->json($response, array('success'=>true, 'message'=>'', 'data'=>$data))->withStatus(200);
} /* }}} */
function changeUserHomefolder($request, $response, $args) { /* {{{ */
@ -2289,23 +2290,28 @@ final class SeedDMS_RestapiController { /* {{{ */
return;
}
if(!ctype_digit($args['folderid']) || $args['folderid'] == 0) {
if(!ctype_digit($args['folderid'])) {
return $this->renderer->json($response, array('success'=>false, 'message'=>'No homefolder given', 'data'=>''))->withStatus(400);
return;
}
$newHomefolder = $dms->getFolder($args['folderid']);
if (!$newHomefolder) {
return $this->renderer->json($response, array('success'=>false, 'message'=>'', 'data'=>'Folder not found.'))->withStatus(404);
return;
}
if($args['folderid'] == 0) {
$operation = $account->setHomeFolder(0);
} else {
$newHomefolder = $dms->getFolder($args['folderid']);
if (!$newHomefolder) {
return $this->renderer->json($response, array('success'=>false, 'message'=>'', 'data'=>'Folder not found.'))->withStatus(404);
return;
}
$operation = $account->setHomeFolder($newHomefolder->getId());
$operation = $account->setHomeFolder($newHomefolder->getId());
}
if (!$operation){
return $this->renderer->json($response, array('success'=>false, 'message'=>'', 'data'=>'Could not change homefolder.'))->withStatus(404);
}
return $this->renderer->json($response, array('success'=>true, 'message'=>'', 'data'=>''))->withStatus(200);
$data = $this->__getUserData($account);
return $this->renderer->json($response, array('success'=>true, 'message'=>'', 'data'=>$data))->withStatus(200);
} /* }}} */
function getUserById($request, $response, $args) { /* {{{ */