File tree Expand file tree Collapse file tree
packages/react-ui/src/app Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,13 +55,15 @@ export const useMenuLinks = () => {
5555 to : '/tables' ,
5656 label : t ( 'Tables' ) ,
5757 icon : TableProperties ,
58+ locked : ! checkAccess ( Permission . WRITE_TABLE ) ,
5859 } ,
5960 ...( hasAnalyticsAccess
6061 ? [
6162 {
6263 to : '/analytics' ,
6364 label : t ( 'Analytics' ) ,
6465 icon : LucideBarChart2 ,
66+ locked : ! checkAccess ( Permission . WRITE_ANALYTICS ) ,
6567 } ,
6668 ]
6769 : [ ] ) ,
Original file line number Diff line number Diff line change 1+ import { Navigate } from 'react-router-dom' ;
2+
3+ import { useAuthorization } from '@/app/common/hooks/authorization-hooks' ;
14import { flagsHooks } from '@/app/common/hooks/flags-hooks' ;
25import { useDefaultSidebarState } from '@/app/common/hooks/use-default-sidebar-state' ;
36import { useCandu } from '@/app/features/extensions/candu/use-candu' ;
4- import { FlagId } from '@openops/shared' ;
7+ import { FlagId , Permission } from '@openops/shared' ;
58
69import {
710 AnalyticsDashboardEmptyState ,
@@ -14,7 +17,7 @@ import { useEmbedDashboard } from './use-embed-dashboard';
1417
1518const OpenOpsAnalyticsPage = ( ) => {
1619 useDefaultSidebarState ( 'minimized' ) ;
17-
20+ const { checkAccess } = useAuthorization ( ) ;
1821 const { isCanduEnabled, canduClientToken, canduUserId } = useCandu ( ) ;
1922 const { data : analyticsPublicUrl } = flagsHooks . useFlag < string | undefined > (
2023 FlagId . ANALYTICS_PUBLIC_URL ,
@@ -36,6 +39,10 @@ const OpenOpsAnalyticsPage = () => {
3639 canduUserId,
3740 } ) ;
3841
42+ if ( ! checkAccess ( Permission . WRITE_ANALYTICS ) ) {
43+ return < Navigate to = "/" replace /> ;
44+ }
45+
3946 if ( ! analyticsPublicUrl ) {
4047 console . error ( 'OpenOps Analytics URL is not defined' ) ;
4148 return null ;
Original file line number Diff line number Diff line change 11import { t } from 'i18next' ;
2- import { useLocation } from 'react-router-dom' ;
2+ import { Navigate , useLocation } from 'react-router-dom' ;
33
4+ import { useAuthorization } from '@/app/common/hooks/authorization-hooks' ;
45import { flagsHooks } from '@/app/common/hooks/flags-hooks' ;
56import { useDefaultSidebarState } from '@/app/common/hooks/use-default-sidebar-state' ;
67import { useCandu } from '@/app/features/extensions/candu/use-candu' ;
7- import { FlagId } from '@openops/shared' ;
8+ import { FlagId , Permission } from '@openops/shared' ;
89
910const OpenOpsTablesPage = ( ) => {
1011 useDefaultSidebarState ( 'minimized' ) ;
12+ const { checkAccess } = useAuthorization ( ) ;
1113 const { isCanduEnabled, canduClientToken, canduUserId } = useCandu ( ) ;
1214 const parentData = encodeURIComponent (
1315 JSON . stringify ( { isCanduEnabled, userId : canduUserId , canduClientToken } ) ,
@@ -22,6 +24,10 @@ const OpenOpsTablesPage = () => {
2224 FlagId . OPENOPS_TABLES_PUBLIC_URL ,
2325 ) ;
2426
27+ if ( ! checkAccess ( Permission . WRITE_TABLE ) ) {
28+ return < Navigate to = "/" replace /> ;
29+ }
30+
2531 if ( ! openopsTablesUrl ) {
2632 console . error ( 'OpenOps Tables URL is not defined' ) ;
2733 return null ;
You can’t perform that action at this time.
0 commit comments