protected Collection < Permission > getRolePermissions ( String role ) { if ( role == null ) { return null ; } Cache < String , RolePermissionSet > cache = getAvailableRolesCache ( ) ; if ( cache == null ) { return _permissionReader . getPermissions ( PermissionIDs . forRole ( role ) ) ; } RolePermissionSet rolePermissionSet = cache . get ( role ) ; if ( rolePermissionSet == null ) { Set < Permission > permissions = _permissionReader . getPermissions ( PermissionIDs . forRole ( role ) ) ; rolePermissionSet = new SimpleRolePermissionSet ( permissions ) ; cache . put ( role , rolePermissionSet ) ; } return rolePermissionSet . permissions ( ) ; }
Gets the permissions for a role . If possible the permissions are cached for efficiency .