File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed
packages/react-ui/src/app Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change 1- import { authenticationSession } from '@/app/lib/authentication-session' ;
21import { FlagId } from '@openops/shared' ;
32import { useMemo } from 'react' ;
43import { flagsHooks } from './flags-hooks' ;
4+ import { userHooks } from './user-hooks' ;
55
66export const useHasAnalyticsAccess = ( ) : boolean => {
77 const { data : isAnalyticsEnabled } = flagsHooks . useFlag < boolean | undefined > (
88 FlagId . ANALYTICS_ENABLED ,
99 ) ;
1010
11- const hasAnalyticsPrivileges =
12- authenticationSession . getUserHasAnalyticsPrivileges ( ) ;
11+ const { userMeta } = userHooks . useUserMeta ( ) ;
12+ const hasAnalyticsAccess = userMeta ?. projectPermissions ?. analytics ?? false ;
1313
1414 return useMemo (
15- ( ) => Boolean ( isAnalyticsEnabled && hasAnalyticsPrivileges ) ,
16- [ isAnalyticsEnabled , hasAnalyticsPrivileges ] ,
15+ ( ) => Boolean ( isAnalyticsEnabled && hasAnalyticsAccess ) ,
16+ [ isAnalyticsEnabled , hasAnalyticsAccess ] ,
1717 ) ;
1818} ;
Original file line number Diff line number Diff line change @@ -51,10 +51,6 @@ export const authenticationSession = {
5151 return this . getCurrentUser ( ) ?. projectRole ?? null ;
5252 } ,
5353
54- getUserHasAnalyticsPrivileges ( ) : boolean {
55- return this . getCurrentUser ( ) ?. hasAnalyticsPrivileges ?? false ;
56- } ,
57-
5854 getUserOrganizationRole ( ) {
5955 return this . getCurrentUser ( ) ?. organizationRole ?? null ;
6056 } ,
You can’t perform that action at this time.
0 commit comments