Fix permission checking to also look for global database rights, not just table based