From 28e9b37a6dce84f1d71d4d22f0b436fb82696d1f Mon Sep 17 00:00:00 2001
From: Yannis Barlas <yannisbarlas@gmail.com>
Date: Wed, 20 May 2020 20:22:18 +0300
Subject: [PATCH] docs(middleware): update authorization readme

---
 README.md | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/README.md b/README.md
index cde7de9..4c7b69e 100644
--- a/README.md
+++ b/README.md
@@ -41,6 +41,7 @@ If you place this file in `server/app.js`, starting the server should work autom
 The server provides authorization checks through using `graphql-shield`.  
 You can access all of shield's exports (eg. `rule`, `and`, `or` etc.) through `@coko/server/authorization`.  
 The only exception is `shield`, which is used internally by the server.
+Besides shield's exports, two helpers, `isAdmin` and `isAuthenticated` are provided.
 
 To get started, declare your permissions in any file you want:
 
@@ -54,6 +55,9 @@ const permissions = {
     myQuery: rule()(async (parent, args, ctx, info) => {
       // my auth logic here
     }),
+    // using provided helpers
+    anotherQuery: isAdmin,
+    yetAnotherQuery: isAuthenticated,
   },
   Mutation: {
     myMutation: rule()(async (parent, args, ctx, info) => {
-- 
GitLab