Refactor of db and users permissions
Some privileges fixes