question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Disable click on <*Button>s when unauthorized

See original GitHub issue

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 the button appear as disabled (but still clickable).

When clicked you’re (of course) redirected to a 404 page.

I’d also love to have a prop on the Buttons (ListButton, EditButton, ShowButton, DeleteButton) (e.g showWhenUnauthorized - default: true ) to avoid showing unauthorized buttons at all, as they should not be clicked by basic users, so it’ useless to even show them

Steps To Reproduce

  1. Setup providers to set “can: false” on some resource/actions
  2. Create a <ShowButton> or <EditButton> for given resource/action
  3. Click on the button

Expected behavior

You should

1- Not be redirected to a 404 page 2- (Even better) Not see the disabled button at all (maybe behind a showWhenUnauthorized prop)

Screenshot

No response

Desktop

No response

Mobile

No response

Additional Context

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aliemircommented, Oct 19, 2022

Hey @kino90, just merged #2838 to resolve this issue. I’ll ping once more when its released and hopefully confirm this is fixed. 🚀 🚀

1reaction
aliemircommented, Oct 19, 2022

Hey @kino90, disabled buttons should not be clickable and that should have been caught in the tests 🤦 Sorry for the issue, let me quickly check what we can do in short time 🙏 We’ll try to add an option to hide if unauthorized but it will be better for us to move that into a feature request 🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disabling the button after once click - Stack Overflow
I need to disable a button once it's clicked so the user can't click it more than once. (My application is written in...
Read more >
[Bug] Button with disabled=True allows click from ... - GitHub
If a button is created with bind_return_key=True , it will still "click" using the Enter key even if it is disabled. To test,...
Read more >
How to hide buttons for unauthorized users - Acorel
You must right click this method and “Redefine”: 7) In the code first call the super class. 8) Then put in code to...
Read more >
Open a Mac app from an unidentified developer - Apple Support
Control-click the app icon, then choose Open from the shortcut menu. Click Open. The app is saved as an exception to your security...
Read more >
Anypoint SAML SSO Error - Unauthorized: IDP-initiated SSO
SYMPTOM. While user click the "Back button" in browser after login into Anypoint Platform via SSO. it will show error of "Unauthorized: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found