Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2023-12-19 09:32:14 +01:00
commit ddfe87a82c
2 changed files with 19 additions and 1 deletions

View File

@ -292,6 +292,7 @@
- show preview of documents on clipboard
- minor improvements in restapi
- update layout of tab for attachments
- remove session when calling logout of restapi
--------------------------------------------------------------------------------
Changes in version 5.1.32

View File

@ -258,7 +258,24 @@ class RestapiController { /* {{{ */
$userobj = $this->container->userobj;
$settings = $this->container->config;
setcookie("mydms_session", '', time()-3600, $settings->_httpRoot);
if(isset($_COOKIE['mydms_session'])) {
$dms_session = $_COOKIE["mydms_session"];
$db = $dms->getDb();
$session = new SeedDMS_Session($db);
$session->load($dms_session);
// If setting the user id to 0 worked, it would be a way to logout a
// user. It doesn't work because of a foreign constraint in the database
// won't allow it. So we keep on deleting the session and the cookie on
// logout
// $session->setUser(0); does not work because of foreign user constraint
if(!$session->delete($dms_session)) {
UI::exitError(getMLText("logout"),$db->getErrorMsg());
}
setcookie("mydms_session", '', time()-3600, $settings->_httpRoot);
}
return $response->withJson(array('success'=>true, 'message'=>'', 'data'=>''), 200);
} /* }}} */