HasRole function

Awesome feedback @half-halt.

For what it is worth, consider that the resolution of roles can be lazy process. If you need access to a resource the roles are scanned to check if if any apply. If multiple roles give access to the same action and the same resource, then whichever gets encountered first will allow the transaction to continue, and the other might not ever be evaluated.

To have every query actively compute all role-predicates in advance (e.g. include a list in CurrentIdentity by default) would add additional computation/latency to a lot of common Fauna operations for many that don’t need it.

All that said, I think there’s a clearly value in an HasRole function, as you’ve demonstrated.