diff --git a/odd-platform-ui/src/components/shared/contexts/Permission/WithPermissions.tsx b/odd-platform-ui/src/components/shared/contexts/Permission/WithPermissions.tsx index 778e74cba..1fbe74042 100644 --- a/odd-platform-ui/src/components/shared/contexts/Permission/WithPermissions.tsx +++ b/odd-platform-ui/src/components/shared/contexts/Permission/WithPermissions.tsx @@ -14,10 +14,10 @@ const WithPermissions: React.FC = ({ extraCheck, children, }) => { - const { isAllowedTo, hasAccessTo } = usePermissions(); + const { hasAccessTo } = usePermissions(); if (renderContent) { - return <>{renderContent({ isAllowedTo })}; + return <>{renderContent({ isAllowedTo: hasAccessTo(permissionTo) })}; } if (children && extraCheck !== undefined) { diff --git a/odd-platform-ui/src/lib/hooks/usePermissions.ts b/odd-platform-ui/src/lib/hooks/usePermissions.ts index 393329d45..f155042b9 100644 --- a/odd-platform-ui/src/lib/hooks/usePermissions.ts +++ b/odd-platform-ui/src/lib/hooks/usePermissions.ts @@ -8,8 +8,7 @@ interface UsePermissionReturn { } const usePermissions = (): UsePermissionReturn => { - const { isAllowedTo, getHasAccessTo } = useContext(PermissionContext); - const hasAccessTo = getHasAccessTo; + const { isAllowedTo, getHasAccessTo: hasAccessTo } = useContext(PermissionContext); return { isAllowedTo, hasAccessTo }; };