Skip to content

feat: show dialog with a redirect if permissions are required #16661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 21, 2025

Conversation

brettkolodny
Copy link
Contributor

Closes this issue

New behavior

When a user ends up on a page they don't have permission to view instead of being redirected back to /workspaces they'll be met with the un-closeable dialog below with a link to /workspaces.

This is similar to this PR but IMO we should be making sure we are using <RequirePermissions /> wherever applicable and only relying on <ErrorAlert /> as a fallback in case there is some page we missed or endpoint we're accidentally using.

Screenshot 2025-02-21 at 4 50 58 PM

Copy link
Member

@aslilac aslilac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it!

@@ -14,7 +22,25 @@ export const RequirePermission: FC<RequirePermissionProps> = ({
isFeatureVisible,
}) => {
if (!isFeatureVisible) {
return <Navigate to="/workspaces" />;
// return <Navigate to="/workspaces" />;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// return <Navigate to="/workspaces" />;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦

@brettkolodny brettkolodny merged commit 39f42bc into main Feb 21, 2025
30 checks passed
@brettkolodny brettkolodny deleted the brett/improve-requirepermission-component branch February 21, 2025 22:43
@github-actions github-actions bot locked and limited conversation to collaborators Feb 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

improve RequirePermission component
2 participants