From 434110486c3162e4764e6d64ff9cb0b2231b23b7 Mon Sep 17 00:00:00 2001 From: brave-builds <45370463+brave-builds@users.noreply.github.com> Date: Wed, 15 Jan 2025 02:30:29 +0100 Subject: [PATCH] "IPFSEnabled" Group Policy Documentation is No Longer Relevant (uplift to 1.75.x) (#27231) Uplift of #27086 (squashed) to beta --- browser/policy/brave_simple_policy_map.h | 11 ++++++++++ components/ipfs/ipfs_prefs.cc | 7 ++---- components/ipfs/ipfs_prefs.h | 7 ++++++ .../BraveSoftware/IPFSEnabled.yaml | 22 +++++++++++++++++++ 4 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 components/policy/resources/templates/policy_definitions/BraveSoftware/IPFSEnabled.yaml diff --git a/browser/policy/brave_simple_policy_map.h b/browser/policy/brave_simple_policy_map.h index fa9f23f85ea9..1f4874a3e410 100644 --- a/browser/policy/brave_simple_policy_map.h +++ b/browser/policy/brave_simple_policy_map.h @@ -9,6 +9,7 @@ #include "brave/components/ai_chat/core/common/pref_names.h" #include "brave/components/brave_vpn/common/buildflags/buildflags.h" #include "brave/components/constants/pref_names.h" +#include "brave/components/ipfs/buildflags/buildflags.h" #include "brave/components/tor/buildflags/buildflags.h" #include "build/build_config.h" #include "components/policy/core/browser/configuration_policy_handler.h" @@ -28,6 +29,10 @@ #include "brave/components/brave_vpn/common/pref_names.h" #endif +#if BUILDFLAG(DEPRECATE_IPFS) +#include "brave/components/ipfs/ipfs_prefs.h" +#endif // BUILDFLAG(DEPRECATE_IPFS) + namespace policy { inline constexpr PolicyToPreferenceMapEntry kBraveSimplePolicyMap[] = { @@ -54,6 +59,12 @@ inline constexpr PolicyToPreferenceMapEntry kBraveSimplePolicyMap[] = { #endif {policy::key::kBraveAIChatEnabled, ai_chat::prefs::kEnabledByPolicy, base::Value::Type::BOOLEAN}, + +#if BUILDFLAG(DEPRECATE_IPFS) + {policy::key::kIPFSEnabled, ipfs::prefs::kIPFSEnabledByPolicy, + base::Value::Type::BOOLEAN}, +#endif // BUILDFLAG(DEPRECATE_IPFS) + }; } // namespace policy diff --git a/components/ipfs/ipfs_prefs.cc b/components/ipfs/ipfs_prefs.cc index 14549b0c1b3d..b1d7393bf510 100644 --- a/components/ipfs/ipfs_prefs.cc +++ b/components/ipfs/ipfs_prefs.cc @@ -36,9 +36,6 @@ inline constexpr char kIPFSInfobarCount[] = "brave.ipfs.infobar_count"; // The number of storage used by IPFS Node inline constexpr char kIpfsStorageMax[] = "brave.ipfs.storage_max"; -// Used to enable/disable IPFS via admin policy. -inline constexpr char kIPFSEnabled[] = "brave.ipfs.enabled"; - // Used to determine if local node was ever used. inline constexpr char kIPFSLocalNodeUsed[] = "brave.ipfs.local_node_used"; @@ -81,7 +78,7 @@ inline constexpr char kIPFSCompanionEnabled[] = "brave.ipfs_companion_enabled"; namespace ipfs { void RegisterDeprecatedIpfsPrefs(PrefRegistrySimple* registry) { - registry->RegisterBooleanPref(kIPFSEnabled, true); + registry->RegisterBooleanPref(prefs::kIPFSEnabledByPolicy, true); registry->RegisterIntegerPref(kIPFSResolveMethod, 0); registry->RegisterBooleanPref(kIPFSAutoFallbackToGateway, false); registry->RegisterBooleanPref(kIPFSAlwaysStartMode, false); @@ -105,7 +102,7 @@ void RegisterDeprecatedIpfsPrefs(PrefRegistrySimple* registry) { } void ClearDeprecatedIpfsPrefs(PrefService* registry) { - registry->ClearPref(kIPFSEnabled); + registry->ClearPref(prefs::kIPFSEnabledByPolicy); registry->ClearPref(kIPFSResolveMethod); registry->ClearPref(kIPFSAutoFallbackToGateway); registry->ClearPref(kIPFSAlwaysStartMode); diff --git a/components/ipfs/ipfs_prefs.h b/components/ipfs/ipfs_prefs.h index 5cbc7eabb59c..7defc5045b92 100644 --- a/components/ipfs/ipfs_prefs.h +++ b/components/ipfs/ipfs_prefs.h @@ -11,6 +11,13 @@ namespace ipfs { +namespace prefs { + +// Used to enable/disable IPFS via admin policy. Deprecated +inline constexpr char kIPFSEnabledByPolicy[] = "brave.ipfs.enabled"; + +} // namespace prefs + void RegisterDeprecatedIpfsPrefs(PrefRegistrySimple* registry); void ClearDeprecatedIpfsPrefs(PrefService* profile_prefs); diff --git a/components/policy/resources/templates/policy_definitions/BraveSoftware/IPFSEnabled.yaml b/components/policy/resources/templates/policy_definitions/BraveSoftware/IPFSEnabled.yaml new file mode 100644 index 000000000000..61c6e4c0bcdd --- /dev/null +++ b/components/policy/resources/templates/policy_definitions/BraveSoftware/IPFSEnabled.yaml @@ -0,0 +1,22 @@ +caption: Enable IPFS feature +default: null +desc: |- + This policy allows an admin to specify whether IPFS feature can be enabled. +example_value: true +features: + can_be_mandatory: true + can_be_recommended: false + dynamic_refresh: false + per_profile: true +owners: +- clifton@brave.com +- fmarier@brave.com +- anthony@brave.com +- vstruts@brave.com +schema: + type: boolean +supported_on: +- chrome.*:87- +deprecated: true +tags: [] +type: main