<Can /> or condition
See original GitHub issueHi,
Versions used :
"@casl/ability": "^3.4.0",
"@casl/react": "^1.0.4",
New to casl React, I’ve set it up with my permissions model and rest services. I’ve used it on a first component successfully :
<Can I="create" a="product">
<Button variant="contained" className={classes.button} size="small" onClick={this.startCreation} data-cy="create-user-button">
<AddIcon classes={{root: classes.iconThemeColorGreen}} className={classes.leftIcon} />
Create {this.componentName}
</Button>
</Can>
But now, I have a case where user can go on a product with one button and permission Read OR Edit.
How can I make it using usefull component <Can />
and without having to write a multiple test with ability.can || ability.can
… and create a specific variable injected in my JSX afterwards ?
Thanks,
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
English verb conjugation CAN CONDITION
English verb conjugation can condition to the masculine with a modal can. Regular verb: condition - conditioned - conditioned.
Read more >SQL: Combining the AND and OR Conditions
The SQL AND condition and OR condition can be combined to test for multiple conditions in a SELECT, INSERT, UPDATE, or DELETE statement....
Read more >Using IF with AND, OR and NOT functions
The AND and OR functions can support up to 255 individual conditions, but it's not good practice to use more than a few...
Read more >Conditionals | Grammar | EnglishClub
The word "condition" means "situation or circumstance". If a particular condition is true, then a particular result happens:
Read more >Conditionals: other expressions ( unless, should, as long as )
Conditional clauses can begin with unless. Unless means something similar to 'if … not' or 'except if'. The verb forms in the examples...
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 have check and I did both world : it was a long time ago …
In ability:
Use it :
abilityServices.can([SecurityConst.permissionType.edit], this.props.form.formObject)
OR
Then
//Security import Can from '../../../../components/ui/security/CanControl'
and finally:
<Can I={SecurityConst.permissionType.create} a={SecurityConst.permission.toolAdministration.module + "_" + SecurityConst.permission.toolAdministration.objects.user}>
Thank you for your quick reply and sharing this. This is great! Cheers!