how to merge multi permission into one?
See original GitHub issuefollow the README, we have to defined the big permission object like this:
const permissions = shield({
Query: {
frontPage: not(isAuthenticated),
fruits: and(isAuthenticated, or(isAdmin, isEditor)),
customers: and(isAuthenticated, isAdmin)
},
Mutation: {
addFruitToBasket: isAuthenticated,
},
Fruit: isAuthenticated,
Cusomer: isAdmin
})
could you give something like merge
const permissions = mergeShield({
1Resolve,
2Resolve,
...
});
Issue Analytics
- State:
- Created 5 years ago
- Comments:7
Top Results From Across the Web
how to merge multi permission into one? · Issue #50 - GitHub
It merges the permissions together correctly allowing the following: // file1.js export default { Query: { getSecurityQuestions: allow, } ...
Read more >Merge 3 Permission Sets into 1 - Salesforce Stack Exchange
This answer assumes you are managing the permission sets in a version control system and pushing/deploying changes to your org from your ...
Read more >Is there a way to merge the files/permissions from one user on a
Is there a way to merge the files/permissions from one user on a computer to another user on the same computer WITHOUT overwriting...
Read more >linux - changing multiple permissions with one single command
I was wondering if there is a way to combine these three commands into one without using octal numbers. linux · command-line ·...
Read more >Merge Permission Sets - IdeaExchange - Salesforce
merge permission sets into Profiles: permanently alter the Profile by incorporating all the permissions in the permission set; merge permission sets into other ......
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
@leonelpena and others who come across this issue… To accomplish what the OP and myself are looking to do, you can use a library called “assign-deep”. https://www.npmjs.com/package/assign-deep.
It merges the permissions together correctly allowing the following:
This produces the correct output that graphql-shield needs to operate.
I have given a bit more thought to your problem. I am not sure this is your case, but here are two things that you can do.
1.
Because
shield
accepts a JSON object as an argument defining your schema, you could useObject.assign
orES6
merge syntax to merge your permissions into one.2.
You can logically combine your permissions using logic operators. Available operators are
and
,or
andnot
. You can read more about them here https://github.com/maticzav/graphql-shield#and-or-not