Auth helper functions
Let's add a couple of generic helper rules to our auth middleware and export them along with the rest of the shield items.
-
isAuthenticated
: basically check thatctx.user
is defined -
isAdmin
: We need to get the user object here. There is a boolean property calledadmin
on the user.