add tests for middleware
Add isAnyResourceAllowed to check if have permission to anyone of resources. This will be useful for supporting hierarchical resource.
Adjust tests to cover more scenarios related isAnyResourceAllowed.
Enhance middleware() to make the resource support more flexible.