Use exists() instead of count() for is_permission_restricted
There is no point in counting all permissions if the final count will only be compared to zero.
Instead of use exists() which returns True as soon as first permission encountered.
Gives +10% performance boost even on small permission tables and much larger boost for large permission tables.