Q:

Joomla custom authentication plugin against own database table

I've created a custom authentication plugin, which allows me to login to Joomla with my own user Table.  So at this point, the authentication to the system is working and a user object will be created.  All information until logout can be seen with $user = JFactory::getUser();. 
My problem is, that after login, my menue won't be shown.  It seems, that my template is not loaded.  If I manually change the userid to one of the registered users in Joomla (only the id will be changed, no other values of the user object), the template will be loaded and the menue will be shown. 
What do I have to do to get this to work?  What is missing, or what do I wrong? 

A:

Because of the Joomla rights system, Joomla calls getAuthorisedViewLevels() and getGroupsByUser() in libraries/joomla/access/access.phpin and looks up the groups from user_usergroup_map. 
Because it is an external user authentication, there is no user_usergroup mapping. 
Therfore I built a work around.  During the login procedure I added a function to my plugin which sets the user_id in the user_usergroup_map table for temporary using. 
In case of logging out, the entry in the user_usergroup_map table will be removed.