Reusable rules: hasRole functionality
See original GitHub issueI just updated to graphql-shield v2.0.6 and now I get this error on running my Node.js app:
RangeError: Maximum call stack size exceeded
at convertRulesToMiddleware (/path-to-server/server/node_modules/graphql-shield/dist/index.js:1:1)
at leafs.reduce (/path-to-server/server/node_modules/graphql-shield/dist/index.js:232:84)
at Array.reduce (<anonymous>)
at convertRulesToMiddleware (/path-to-server/server/node_modules/graphql-shield/dist/index.js:232:30)
at leafs.reduce (/path-to-server/server/node_modules/graphql-shield/dist/index.js:232:84)
at Array.reduce (<anonymous>)
at convertRulesToMiddleware (/path-to-server/server/node_modules/graphql-shield/dist/index.js:232:30)
at leafs.reduce (/path-to-server/server/node_modules/graphql-shield/dist/index.js:232:84)
at Array.reduce (<anonymous>)
at convertRulesToMiddleware (/path-to-server/server/node_modules/graphql-shield/dist/index.js:232:30)
at leafs.reduce (/path-to-server/server/node_modules/graphql-shield/dist/index.js:232:84)
at Array.reduce (<anonymous>)
at convertRulesToMiddleware (/path-to-server/server/node_modules/graphql-shield/dist/index.js:232:30)
at leafs.reduce (/path-to-server/server/node_modules/graphql-shield/dist/index.js:232:84)
at Array.reduce (<anonymous>)
at convertRulesToMiddleware (/path-to-server/server/node_modules/graphql-shield/dist/index.js:232:30)
Issue Analytics
- State:
- Created 5 years ago
- Comments:12
Top Results From Across the Web
Uses of hasRole() Methods (client and server side)
Server Side:- This is the Case where the details of current logged in users are available in the Database. we have to fetch...
Read more >Introduction to Spring Method Security | Baeldung
In above example, the security rule hasRole('ROLE_ADMIN') will be applied to both getSystemYear and getSystemDate methods.
Read more >Role Based Authorization With Firestore - Fireship
This function makes it easy to write rules by saying hasRole('admin') == true , as opposed to writing out the entire path for...
Read more >Validate End User Permissions in the Application
If you need to restrict end user access to specific areas or operations in an application, you must validate their permissions.
Read more >Redesigning Access Control for the OpenZeppelin Contracts - #13 ...
Following that model is easy to code a base RBAC contract that just records the Roles, and then segregate in different contracts the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dakshshah96 I have just noticed it. You are not using
graphql-yoga
. Because of this, you cannot usemiddlewares
property to assign middleware to your schema. To make this work, you have to usegraphql-middleware
like this;Hope this helps you out! 🙂
@maticzav Thank you so much for your patience.
Everything works as expected now 💯