refresh database on permission change

+ refresh database on permission change
+ implementd as a generic onLogin framework method