{"record":{"id":"be7b3d801226587d","repo":"Dolibarr/dolibarr","slug":"you-are-logged-with-user-session-dol-login-and-only","errorCode":null,"errorMessage":"You are logged with user \"${_SESSION[dol_login]}\" and only administrator users (${MAIN_ONLY_LOGIN_ALLOWED}) is allowed to connect for the moment.","messagePattern":"You are logged with user \"(.+?)\" and only administrator users \\((.+?)\\) is allowed to connect for the moment\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"htdocs/main.inc.php","lineNumber":193,"sourceCode":"\n// If software has been locked. Only login getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED') is allowed.\nif (getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')) {\n\t$ok = 0;\n\tif ((!session_id() || !isset($_SESSION[\"dol_login\"])) && !isset($_POST[\"username\"]) && !empty($_SERVER[\"GATEWAY_INTERFACE\"])) {\n\t\t$ok = 1; // We let working pages if not logged and inside a web browser (login form, to allow login by admin)\n\t} elseif (isset($_POST[\"username\"]) && in_array($_POST[\"username\"], explode(';', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')))) {\n\t\t$ok = 1; // We let working pages that is a login submission (login submit, to allow login by admin)\n\t} elseif (defined('NOREQUIREDB')) {\n\t\t$ok = 1; // We let working pages that don't need database access (xxx.css.php)\n\t} elseif (defined('EVEN_IF_ONLY_LOGIN_ALLOWED')) {\n\t\t$ok = 1; // We let working pages that ask to work even if only login enabled (logout.php)\n\t} elseif (session_id() && isset($_SESSION[\"dol_login\"]) && in_array($_SESSION[\"dol_login\"], explode(';', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')))) {\n\t\t$ok = 1; // We let working if user is allowed admin\n\t}\n\tif (!$ok) {\n\t\tif (session_id() && isset($_SESSION[\"dol_login\"]) && !in_array($_SESSION[\"dol_login\"], explode(';', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')))) {\n\t\t\tprint 'Sorry, your application is offline.'.\"\\n\";\n\t\t\tprint 'You are logged with user \"'.$_SESSION[\"dol_login\"].'\" and only administrator users (' . str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'.\"\\n\";\n\t\t\t$nexturl = dolBuildUrl(DOL_URL_ROOT . '/user/logout.php', [], true);\n\t\t\tprint 'Please try later or <a href=\"'.$nexturl.'\">click here to disconnect and change login user</a>...'.\"\\n\";\n\t\t} else {\n\t\t\tprint 'Sorry, your application is offline. Only administrator users (' . str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'.\"\\n\";\n\t\t\t$nexturl = dolBuildUrl(DOL_URL_ROOT . '/');\n\t\t\tprint 'Please try later or <a href=\"'.$nexturl.'\">click here to change login user</a>...'.\"\\n\";\n\t\t}\n\t\texit;\n\t}\n}\n\n\n// Activate end of page function\nregister_shutdown_function('dol_shutdown');\n\n// Load debugbar\nif (isModEnabled('debugbar') && !GETPOST('dol_use_jmobile') && empty($_SESSION['dol_use_jmobile'])) {\n\tglobal $debugbar;","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/Dolibarr/dolibarr/blob/598aa4bdada683d17ca04b1842548821ff0eb6c6/htdocs/main.inc.php#L175-L211","documentation":"This message complements the previous one: a session exists and dol_login is set, but that login is NOT in the MAIN_ONLY_LOGIN_ALLOWED list. Dolibarr refuses service, tells the user which account they are logged in with, and offers a logout link to switch to an allowed admin account.","triggerScenarios":"MAIN_ONLY_LOGIN_ALLOWED='admin'; a normal user with an active session browses any page while the restriction is active.","commonSituations":"Non-admin users keeping open browser sessions during a maintenance window; stale sessions after the admin narrowed MAIN_ONLY_LOGIN_ALLOWED.","solutions":["Click the provided logout link and re-login as an admin listed in MAIN_ONLY_LOGIN_ALLOWED","Have an admin remove/extend MAIN_ONLY_LOGIN_ALLOWED to include the needed users","Clear the session cookie if the session is stale"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Log out and back in as an allowed admin when maintenance mode is active","Include all necessary operators in MAIN_ONLY_LOGIN_ALLOWED (semicolon-separated)","Inform users their sessions will be refused during maintenance"],"tags":["dolibarr","maintenance-mode","session","access-control"],"backgroundTag":"permission-denied","analyzedSha":"598aa4bdada683d17ca04b1842548821ff0eb6c6","analyzedAt":"2026-09-14T11:12:15.309Z","contentChangedAt":"2026-09-14T11:12:15.309Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}