From 7ee5a8a6af437d97974997d7c84db89d61a8c31e Mon Sep 17 00:00:00 2001 From: Julian Koberg Date: Tue, 20 May 2025 12:00:36 +0200 Subject: [PATCH 1/3] feat(frontend): add server managed spaces capability Publish the spaces.server_managed capability, driven by the OC_CLAIM_MANAGED_SPACES_ENABLED setting, so that clients can block adding and removing users to and from spaces. --- services/frontend/pkg/config/config.go | 2 ++ services/frontend/pkg/revaconfig/config.go | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/services/frontend/pkg/config/config.go b/services/frontend/pkg/config/config.go index bceda65970..0319edcf0d 100644 --- a/services/frontend/pkg/config/config.go +++ b/services/frontend/pkg/config/config.go @@ -61,6 +61,8 @@ type Config struct { ConfigurableNotifications bool `yaml:"configurable_notifications" env:"FRONTEND_CONFIGURABLE_NOTIFICATIONS" desc:"Allow configuring notifications via web client." introductionVersion:"1.0.0"` + ServerManagedSpaces bool `yaml:"server_managed_spaces" env:"OC_CLAIM_MANAGED_SPACES_ENABLED" desc:"Block adding/removing users to spaces through the web UI." introductionVersion:"%%NEXT%%"` + Groupware Groupware `yaml:"groupware"` Context context.Context `yaml:"-"` diff --git a/services/frontend/pkg/revaconfig/config.go b/services/frontend/pkg/revaconfig/config.go index 537b14524c..989661adce 100644 --- a/services/frontend/pkg/revaconfig/config.go +++ b/services/frontend/pkg/revaconfig/config.go @@ -296,12 +296,13 @@ func FrontendConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string }, }, "spaces": map[string]any{ - "version": "1.0.0", - "enabled": true, - "projects": true, - "share_jail": true, - "max_quota": cfg.MaxQuota, - "default_quota": parseQuota(cfg.DefaultQuota), + "version": "1.0.0", + "enabled": true, + "projects": true, + "share_jail": true, + "max_quota": cfg.MaxQuota, + "default_quota": parseQuota(cfg.DefaultQuota), + "server_managed": cfg.ServerManagedSpaces, }, "theme": capabilities.Default().Theme, "search": map[string]any{ From 9cb072872aa84a64488813faf0402f7bb03a00e2 Mon Sep 17 00:00:00 2001 From: Martin Mattel Date: Wed, 21 May 2025 09:49:28 +0200 Subject: [PATCH 2/3] docs(frontend): document the server managed spaces setting Refine the description of the OC_CLAIM_MANAGED_SPACES_ENABLED setting and add a section to the frontend README that explains what it does. --- services/frontend/README.md | 8 ++++++++ services/frontend/pkg/config/config.go | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/services/frontend/README.md b/services/frontend/README.md index 65b09be7a9..c493388722 100644 --- a/services/frontend/README.md +++ b/services/frontend/README.md @@ -134,3 +134,11 @@ For public accessible writable shares, a password can be enforced. To change the Note that changing this environment variable only makes sense if\ `OC_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD`\ is set to `false`. + +## Server Managed Spaces + +The `frontend` service can announce that the membership of spaces is managed by the server instead of by users. To enable this, set the following environment variable to `true`: + +`OC_CLAIM_MANAGED_SPACES_ENABLED` + +When enabled, the `spaces` capability contains `server_managed: true`. Clients like the web UI evaluate this capability and block adding or removing users to or from spaces. diff --git a/services/frontend/pkg/config/config.go b/services/frontend/pkg/config/config.go index 0319edcf0d..1bc358f4d2 100644 --- a/services/frontend/pkg/config/config.go +++ b/services/frontend/pkg/config/config.go @@ -61,7 +61,7 @@ type Config struct { ConfigurableNotifications bool `yaml:"configurable_notifications" env:"FRONTEND_CONFIGURABLE_NOTIFICATIONS" desc:"Allow configuring notifications via web client." introductionVersion:"1.0.0"` - ServerManagedSpaces bool `yaml:"server_managed_spaces" env:"OC_CLAIM_MANAGED_SPACES_ENABLED" desc:"Block adding/removing users to spaces through the web UI." introductionVersion:"%%NEXT%%"` + ServerManagedSpaces bool `yaml:"server_managed_spaces" env:"OC_CLAIM_MANAGED_SPACES_ENABLED" desc:"Mark spaces as managed by the server. Clients like the web UI then block adding or removing users to or from spaces. See the text description for more details." introductionVersion:"%%NEXT%%"` Groupware Groupware `yaml:"groupware"` From ada4f0a5e61cbe9d4c86932b157cba68f5d749b7 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Thu, 12 Nov 2026 14:58:48 +0100 Subject: [PATCH 3/3] test(frontend): cover the server managed spaces capability Assert that the spaces.server_managed capability follows the OC_CLAIM_MANAGED_SPACES_ENABLED setting for both values. --- services/frontend/pkg/revaconfig/config_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/services/frontend/pkg/revaconfig/config_test.go b/services/frontend/pkg/revaconfig/config_test.go index fbaf731150..df8656e4d8 100644 --- a/services/frontend/pkg/revaconfig/config_test.go +++ b/services/frontend/pkg/revaconfig/config_test.go @@ -24,6 +24,20 @@ func TestContentSearchCapabilityFollowsFullTextSearch(t *testing.T) { } } +func TestServerManagedCapabilityFollowsServerManagedSpaces(t *testing.T) { + for _, enabled := range []bool{true, false} { + cfg := defaults.FullDefaultConfig() + cfg.Commons = &shared.Commons{} + cfg.ServerManagedSpaces = enabled + + rcfg, err := FrontendConfigFromStruct(cfg, log.NopLogger()) + require.NoError(t, err) + + got := dig(t, rcfg, "http", "services", "ocs", "capabilities", "capabilities", "spaces")["server_managed"] + require.Equal(t, enabled, got) + } +} + func dig(t *testing.T, m map[string]any, keys ...string) map[string]any { t.Helper() for _, k := range keys {