You need to restore your database or at least the xdat_user table. You should never delete users from that table, as the ID from that table is referenced in other tables through the database schema. If you need to remove a user’s access to your XNAT installation, you should disable the user account from the Manage Users page.
XNAT is fairly old and doesn’t have an idea of an anonymous user, so the guest account is used as a stand-in for anonymous access. That’s accessed pretty early on during start-up so that’s why XNAT is unable to start without that user entry being available.
From:
xnat_di...@googlegroups.com <xnat_di...@googlegroups.com> on behalf of Tashrif <tashri...@gmail.com>
Date: Monday, January 15, 2024 at 6:01 PM
To: xnat_discussion <xnat_di...@googlegroups.com>
Subject: External: [XNAT Discussion] Something super weird happened: I can't find the guest user!
You don't often get email from tashri...@gmail.com. Learn why this is important |
This message comes from an external organization. Be cautious of attachments you are not expecting and wary of embedded links.
--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
xnat_discussi...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/xnat_discussion/8a7850f8-ead2-498e-9d97-4b18f451620fn%40googlegroups.com.
Okay, you’ve run into the XNAT Prime Directive (or, if you like, the First Rule of XNAT Development Club): never ever modify the database without first dumping it so that you can restore it if you mess something up. Any time you’re planning on messing with the contents of the database directly, you should:
This way if something breaks you can restore to a known working point:
As far as restoring the guest user, that’s easy enough:
INSERT INTO public.xdat_user (login, firstname, lastname, email, primary_password, primary_password_encrypt, quarantine_path, enabled, verified, salt, user_info, xdat_user_id, users_user_xdat_security_xdat_security_id)
VALUES ('guest', 'XNAT', 'Guest', '<email>', 'guest', 1, null, 1, 1, null, 2, 2, 1);
If you deleted other users, that’s not something anyone can help you with. You can try recreating with a query similar to the one above, but you’ll need the value for xdat_user_id and it’s difficult to know what that may have been without digging around in other places. Your best bets would be to look at xhbm_xdat_user_auth, which includes the user’s login name, so you can get the last time the user logged in successfully:
xnat=> SELECT last_successful_login FROM xhbm_xdat_user_auth WHERE xdat_username = 'xxx';
last_successful_login
-------------------------
2024-01-03 13:53:42.785
(1 row)
You can use that to try to get the xdat_user_id from xdat_user_login:
xnat=> SELECT user_xdat_user_id
FROM xdat_user_login
WHERE login_date > '2024-01-03 13:53:42.785000'::timestamp - interval '2 seconds'
AND login_date < '2024-01-03 13:53:42.785000'::timestamp + interval '2 seconds';
user_xdat_user_id
-------------------
10
(1 row)
With that, you should be able to recreate the xdat_user row for the user with the correct xdat_user_id value.
* If you can’t drop the database, you can run a query to drop the schemas in the database:
DROP SCHEMA IF EXISTS public CASCADE;
DROP SCHEMA IF EXISTS xdat_search CASCADE;
CREATE SCHEMA public;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO xnat;
You won’t need to run createdb if you do it this way, just restore from your dump file.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/638ed530-5c26-44a9-8f9a-ee3aa7adb375n%40googlegroups.com.
XSync Failed for project Project.
Daily sync failed
Encountered error Invalid Login and/or Passwordorg.nrg.xdat.security.user.exceptions.UserNotFoundException: Invalid Login and/or Password at org.nrg.xdat.security.XDATUser.(XDATUser.java:101) at org.nrg.xdat.security.XDATUserMgmtServiceImpl.getUser(XDATUserMgmtServiceImpl.java:66) at org.nrg.xdat.security.helpers.Users.getUser(Users.java:140) at org.nrg.xsync.services.local.impl.DefaultDailySyncService.syncDaily(DefaultDailySyncService.java:62) at org.nrg.xsync.services.local.impl.DailySync.run(DailySync.java:17) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750)