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