AnonymousUser doesn't exist


Accidently deleted all users with Member.removeAll() from the dev console. Now whatever I type I get the following error:

Error: User AnonymousUser doesn't exist!

How I can fix this?



Member.removeAll() removed not just the Users, but all the AdminGroups and Roles (except the system ones). You effectively wiped out all the access control data. Only way to recover is to restore from the latest db backup. But I am assuming you did this in your local environment, if so you will need to reset the postgres db and re-provision.