diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx index 15928ab8bc133..53e7f2688ef79 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx @@ -130,7 +130,7 @@ export const EditPackagePolicyForm = memo<{ }); const canWriteIntegrationPolicies = useAuthz().integrations.writeIntegrationPolicies; - useSetIsReadOnly(canWriteIntegrationPolicies); + useSetIsReadOnly(!canWriteIntegrationPolicies); const newSecrets = useMemo(() => { if (!packageInfo) { return []; diff --git a/x-pack/plugins/fleet/public/applications/integrations/hooks/use_read_only_context.tsx b/x-pack/plugins/fleet/public/applications/integrations/hooks/use_read_only_context.tsx index a1cc117cea673..fd30ef4b85090 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/hooks/use_read_only_context.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/hooks/use_read_only_context.tsx @@ -33,7 +33,7 @@ export function useIsReadOnly() { export function useSetIsReadOnly(isReadOnly: boolean) { const context = useContext(ReadOnlyContext); useEffect(() => { - context.setIsReadOnly(true); + context.setIsReadOnly(isReadOnly); return () => context.setIsReadOnly(false); - }, [context]); + }, [context, isReadOnly]); }