Skip to content

Add permision check for tables & analytics #2097

Merged
alexandrudanpop merged 4 commits intomainfrom
feat/tables-permissions
Mar 11, 2026
Merged

Add permision check for tables & analytics #2097
alexandrudanpop merged 4 commits intomainfrom
feat/tables-permissions

Conversation

@alexandrudanpop
Copy link
Copy Markdown
Contributor

@alexandrudanpop alexandrudanpop commented Mar 10, 2026

Copilot AI review requested due to automatic review settings March 10, 2026 15:33
@linear
Copy link
Copy Markdown

linear Bot commented Mar 10, 2026

Copilot AI review requested due to automatic review settings March 10, 2026 15:37
@alexandrudanpop alexandrudanpop changed the title Add permision check for tables Add permision check for tables & analytics Mar 10, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a UI-level permission gate for the Tables route and reflects the same permission in the side navigation, aligning Tables access with the existing permission-based menu patterns.

Changes:

  • Redirects away from /tables when the user lacks Permission.WRITE_TABLE.
  • Locks the Tables side-menu link when the user lacks Permission.WRITE_TABLE.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
packages/react-ui/src/app/routes/openops-tables/index.tsx Adds an authorization check to block rendering the Tables iframe page for unauthorized users.
packages/react-ui/src/app/features/navigation/lib/menu-links-hook.ts Locks the Tables menu item based on the same permission check.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread packages/react-ui/src/app/routes/openops-tables/index.tsx
Comment thread packages/react-ui/src/app/routes/openops-tables/index.tsx

if (!checkAccess(Permission.WRITE_ANALYTICS)) {
return <Navigate to="/" replace />;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I know it's already used in multiple places, but maybe we can extract this


export const useCheckAccessAndRedirect = (permission: Permission) => {
  const { checkAccess } = useAuthorization();
  const navigate = useNavigate();

  useEffect(() => {
    if (!checkAccess(permission)) {
      navigate('/', { replace: true });
    }
  }, [checkAccess, permission, navigate]);
};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

will add a small refactor in a separate PR

@sonarqubecloud
Copy link
Copy Markdown

@alexandrudanpop alexandrudanpop merged commit 0239088 into main Mar 11, 2026
25 checks passed
@alexandrudanpop alexandrudanpop deleted the feat/tables-permissions branch March 11, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants