private IPermission [ ] primGetPermissionsForPrincipal ( IAuthorizationPrincipal principal ) throws AuthorizationException { if ( ! this . cachePermissions ) { return getUncachedPermissionsForPrincipal ( principal , null , null , null ) ; } IPermissionSet ps = null ; // Check the caching service for the Permissions first. ps = cacheGet ( principal ) ; if ( ps == null ) synchronized ( principal ) { ps = cacheGet ( principal ) ; if ( ps == null ) { IPermission [ ] permissions = getUncachedPermissionsForPrincipal ( principal , null , null , null ) ; ps = new PermissionSetImpl ( permissions , principal ) ; cacheAdd ( ps ) ; } } // end synchronized return ps . getPermissions ( ) ; }
Returns permissions for a principal . First check the entity caching service and if the permissions have not been cached retrieve and cache them .