or rule not working
See original GitHub issueBug report
- I have checked other issues to make sure this is not a duplicate.
Describe the bug
Using an “or” fails to run all rules.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
(Delete the filler code and replace it with your own)
- This is my GraphQL Schema.
type Query {
hello: String
}
- This is the invoked query
hello
- I use these permissions
const permissions = shield({
Query: {
hello: or(rules.isSuperAdmin, rules.isCompanyManager),
}
})
- This is the error I see
Not Authorised!
Expected behavior
Expected to be granted permission as isCompanyManager
returns true.
Additional context
Here are the rule definitions used;
export const rules = {
isSuperAdmin: rule(options)(async (_, args, ctx, info) => {
const res = ctx.req.user.permissions.filter(
e => e.group === "superAdmin"
).length
? true
: false;
return res;
}),
isCompanyManager: rule(options)(async (_, args, ctx, info) => {
const res = ctx.req.user.permissions.filter(
e => e.group === "companyManager"
).length
? true
: false;
return res;
})
};
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top Results From Across the Web
How to Fix It When Outlook Rules Are Not Working - Lifewire
How to Fix Outlook Rules Not Working ; File > ; Manage Rules & Alerts. Check the box next to the rule you...
Read more >The rule I created does not work - Microsoft Support
Cause: Rules run automatically on messages only as you receive or send them. · At the bottom of the navigation pane, click Mail...
Read more >[Solved] Outlook Rules Are Not Working | Complete Guide
How to Fix It When Outlook Rules Are Not Working? · Open Outlook and go to Files > Rules and Alerts. · In...
Read more >How to Fix Outlook Rules Not Working in Windows 10
Solved: Outlook Rules not working · Method 1. Optimize the size of your rules · Method 2. Enable rules for your account ·...
Read more >Outlook Rules Not Working? Try These 11 Fixes
Open Outlook on the web and click on the Settings icon · Select View All Settings Option and go to Mail · Click...
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
I’m actually getting the same error. Setting cache type doesn’t help.
Update: It actually only works when I don’t try to reference
parent
orargs
.Update 2: There was actually an exception being thrown 😬in the rule.
It would be nice to be able to see the output of the error being thrown.
Sooo…i wrote
no-cache
instead ofno_cache
, thats why it broke. My bad!