plain-purpleโข4y ago
Hide *Button for forbidden actions
Hi! Is there a way to avoid the disabled button for actions an user cannot do (because unauthorized)?
Right now my "basic user" should only be able to see (not edit) a list, and its detail. Using
<EditButton> in the actions column instead makes the button appear as disabled (but still clickable).
Is there a way to either :
1- disable also the click on the button
2- do not print the button at all if can is false9 Replies
plain-purpleOPโข4y ago
<DeleteButton> already has Solution #1, because it relies on the onClick, which is not triggered on a disabled button
I'd love to see a prop "showWhenUnauthorized" (default true) that hides the button at all if can for that action is falseHey @kino90 ,
I hope you are very well. I am happy to see you again ๐ป
Item 1 is a BUG that definitely needs to be fixed. Can you create an issue for this? (https://github.com/pankod/refine/issues/new?assignees=&labels=bug&template=bug_report.yml&title=%5BBUG%5D)
temporarily you can try this,
plain-purpleOPโข4y ago
Thanks, I'll open the issue right now ๐ in the meantime I'll try with the
<CanAccess> component! Thanks! ๐plain-purpleOPโข4y ago
GitHub
[BUG] Disable click on <*Button>s when unauthorized ยท Issue #2828 ยท...
Describe the bug Right now my "basic user" should only be able to see (not edit) a list, and its detail. Using <EditButton> in the List actions column instead makes ...
Thank you! @kino90
By the way, which UI library are you using?
plain-purpleOPโข4y ago
Mantine ui, sorry.. but if I recall correctly there was the same issue in the antd lib
Hey @kino90 ,
We've released
@pankod/refine-mantine@1.9.0. Could you approve fix?
https://github.com/refinedev/refine/releases/tag/%40pankod%2Frefine-mantine%401.9.0plain-purpleOPโข4y ago
Today and tomorrow I'm not at work, I'll test it next monday! Thanks for the quick fix! ๐