Corrected refreshForGroup to take into account group inheritance and the default group.
Also added debug messages for permission refresh and calculation and changed anti-recursion call.