LPS-32728

Hi Shinn,

This is a somewhat tricky upgrade issue (I've posted reproduction steps on the LPS).
To be honest, I don't even like the current solution as it'll result in more DB queries. However, all of the alternatives that I was able to come up with, either
a) resulted in overly complex SQL queries or
b) would cause an even messier code on 6.1.x (because we have another logic for permission algorithm 5) or
c) just felt wrong and/or regression prone.

That's why I finally decided to go with this one. If you have any other idea on how to fix this, please feel free to change it :)

Thanks,
Daniel