MODE-2042: Test permissions for principals known to the security context
MODE-2042: Optimized permissions checks. Added Testcase