Joomla error 'You cannot access the private section of this site.'

Got the error "You cannot access the private section of this site." on one of my sites when trying to login as a "normal" user in front-end.

This was a pretty interesting issue to find and resolve.
It's an database 'error' of sorts that is pretty simple to fix.
First of all this is all due to a parent<-child condition that has gone horribly wrong in an update or something else.
Most likely you will find this issue in the table "assets".
You will need to find your database prefix fist of all, easiest found in the configuration and the option "$dbprefix". I will call it "prefix_" here for ease of typing.

So to find if you have this issue you can run the following in an sql manager of your choosing (mysql or phpmyadmin shoulden't make any differents, i did it in the cli mysql)

SELECT id,parent_id,title FROM `prefix_assets` WHERE parent_id=0;


If you find that there are multiple rows then hit the above do the following

UPDATE `prefix_assets` SET parent_id=1 WHERE parent_id=0 AND NOT id=1;


You should also verify that the "Root Asset" has id 1 and parent_id 0

SELECT id,parent_id,title FROM `prefix_assets` WHERE id=0 OR parent_id=0;

this should give the result

id parent_id title
 1 0 Root Asset


if not run
UPDATE `prefix_assets` SET parent_id=0 WHERE title="Root Asset";


This should have fixed the issue.
Joomla SEF URLs by Artio