Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#55963] add nextcloud connection validator

Eric Schubert79cbe2004761
diff --git a/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rb b/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rb
new file mode 100644
index 00000000000..2e34ca09dc5
--- /dev/null
+++ b/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rb
@@ -0,0 +1,165 @@
+# frozen_string_literal:true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module Storages
+ module Peripherals
+ class NextcloudConnectionValidator
+ include Dry::Monads[:maybe]
+
+ using ServiceResultRefinements
+
+ def initialize(storage:)
+ @storage = storage
+ end
+
+ def validate
+ maybe_is_not_configured
+ .or { host_url_not_found }
+ .or { missing_dependencies }
+ .or { version_mismatch }
+ .or { request_failed_with_unknown_error }
+ .value_or(ConnectionValidation.new(type: :healthy,
+ error_code: :none,
+ timestamp: Time.current,
+ description: nil))
+ end
+
+ private
+
+ def query
+ @query ||= Peripherals::Registry
+ .resolve("#{@storage.short_provider_type}.queries.capabilities")
+ .call(storage: @storage, auth_strategy:)
+ end
+
+ def maybe_is_not_configured
+ return None() if @storage.configured?
+
+ Some(ConnectionValidation.new(type: :none,
+ error_code: :wrn_not_configured,
+ timestamp: Time.current,
+ description: I18n.t("storages.health.connection_validation.not_configured")))
+ end
+
+ def host_url_not_found
+ return None() if query.result != :not_found
+
+ Some(ConnectionValidation.new(type: :error,
+ error_code: :err_host_not_found,
+ timestamp: Time.current,
+ description: I18n.t("storages.health.connection_validation.host_not_found")))
+ end
+
+ # rubocop:disable Metrics/AbcSize
+ def missing_dependencies
+ return None() if query.failure?
+
+ capabilities = query.result
+
+ if !capabilities.app_enabled? || !capabilities.group_folder_enabled?
+ app_name = if capabilities.app_enabled?
+ I18n.t("storages.dependencies.nextcloud.group_folders_app")
+ else
+ I18n.t("storages.dependencies.nextcloud.integration_app")
+ end
+
+ Some(
+ ConnectionValidation.new(
+ type: :error,
+ error_code: :err_missing_dependencies,
+ timestamp: Time.current,
+ description: I18n.t("storages.health.connection_validation.missing_dependencies", dependency: app_name)
+ )
+ )
+ else
+ None()
+ end
+ end
+
+ # rubocop:enable Metrics/AbcSize
+
+ # rubocop:disable Metrics/AbcSize
+ def version_mismatch
+ return None() if query.failure?
+
+ min_app_version = SemanticVersion.parse(NextcloudIntegration::MIN_APP_VERSION)
+ min_group_folder_version = SemanticVersion.parse(NextcloudIntegration::MIN_GROUP_FOLDER_VERSION)
+
+ capabilities = query.result
+ fetched_app_version = capabilities.app_version
+ fetched_group_folder_version = capabilities.group_folder_version
+
+ if fetched_app_version < min_app_version
+ Some(
+ ConnectionValidation.new(
+ type: :error,
+ error_code: :err_unexpected_version,
+ timestamp: Time.current,
+ description: I18n.t("storages.health.connection_validation.app_version_mismatch",
+ found: fetched_app_version.to_s,
+ expected: min_app_version.to_s)
+ )
+ )
+ elsif fetched_group_folder_version < min_group_folder_version
+ Some(
+ ConnectionValidation.new(
+ type: :error,
+ error_code: :err_unexpected_version,
+ timestamp: Time.current,
+ description: I18n.t("storages.health.connection_validation.group_folder_version_mismatch",
+ found: fetched_group_folder_version.to_s,
+ expected: min_group_folder_version.to_s)
+ )
+ )
+ else
+ None()
+ end
+ end
+
+ # rubocop:enable Metrics/AbcSize
+
+ def request_failed_with_unknown_error
+ return None() if query.success?
+
+ Rails.logger.error("Connection validation failed with unknown error:\n\t" \
+ "storage: ##{@storage.id} #{@storage.name}\n\t" \
+ "status: #{query.result}\n\t" \
+ "response: #{query.error_payload}")
+
+ Some(ConnectionValidation.new(type: :error,
+ error_code: :err_unknown,
+ timestamp: Time.current,
+ description: I18n.t("storages.health.connection_validation.unknown_error")))
+ end
+
+ def auth_strategy = StorageInteraction::AuthenticationStrategies::Noop.strategy
+ end
+ end
+end
diff --git a/modules/storages/app/common/storages/peripherals/nextcloud_registry.rb b/modules/storages/app/common/storages/peripherals/nextcloud_registry.rb
index 707ed76a0a5..f90a3a67fbc 100644
--- a/modules/storages/app/common/storages/peripherals/nextcloud_registry.rb
+++ b/modules/storages/app/common/storages/peripherals/nextcloud_registry.rb
@@ -33,6 +33,7 @@ module Storages
NextcloudRegistry = Dry::Container::Namespace.new("nextcloud") do
namespace("queries") do
register(:auth_check, StorageInteraction::Nextcloud::AuthCheckQuery)
+ register(:capabilities, StorageInteraction::Nextcloud::CapabilitiesQuery)
register(:download_link, StorageInteraction::Nextcloud::DownloadLinkQuery)
register(:file_ids, StorageInteraction::Nextcloud::FileIdsQuery)
register(:file_info, StorageInteraction::Nextcloud::FileInfoQuery)
diff --git a/modules/storages/app/common/storages/peripherals/one_drive_connection_validator.rb b/modules/storages/app/common/storages/peripherals/one_drive_connection_validator.rb
index 4f97eea30f8..213ac5b7fe1 100644
--- a/modules/storages/app/common/storages/peripherals/one_drive_connection_validator.rb
+++ b/modules/storages/app/common/storages/peripherals/one_drive_connection_validator.rb
@@ -158,7 +158,9 @@ module Storages
return None() if query.success?
Rails.logger.error("Connection validation failed with unknown error:\n\t" \
- "status: #{query.result}\n\tresponse: #{query.error_payload}")
+ "storage: ##{@storage.id} #{@storage.name}\n\t" \
+ "status: #{query.result}\n\t" \
+ "response: #{query.error_payload}")
Some(ConnectionValidation.new(type: :error,
error_code: :err_unknown,
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rb
index 23bcc2af114..ccea691f05a 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rb
@@ -36,6 +36,8 @@ module Storages
def self.[](strategy)
case strategy.key
+ when :noop
+ AuthenticationStrategies::Noop.new
when :basic_auth
AuthenticationStrategies::BasicAuth.new
when :oauth_user_token
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/noop.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/noop.rb
new file mode 100644
index 00000000000..0094981f455
--- /dev/null
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication_strategies/noop.rb
@@ -0,0 +1,50 @@
+# frozen_string_literal:true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module Storages
+ module Peripherals
+ module StorageInteraction
+ module AuthenticationStrategies
+ class Noop
+ def self.strategy
+ Strategy.new(:noop)
+ end
+
+ # rubocop:disable Lint/UnusedMethodArgument
+ def call(storage:, http_options: {})
+ yield OpenProject.httpx.with(http_options)
+ end
+
+ # rubocop:enable Lint/UnusedMethodArgument
+ end
+ end
+ end
+ end
+end
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/capabilities_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/capabilities_query.rb
new file mode 100644
index 00000000000..7d2a212b907
--- /dev/null
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/capabilities_query.rb
@@ -0,0 +1,122 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module Storages
+ module Peripherals
+ module StorageInteraction
+ module Nextcloud
+ class CapabilitiesQuery
+ include Dry::Monads[:result]
+ include Dry::Monads::Do.for(:call, :parse_capabilities)
+
+ def self.call(storage:, auth_strategy:)
+ new(storage).call(auth_strategy:)
+ end
+
+ def initialize(storage)
+ @storage = storage
+ end
+
+ def call(auth_strategy:)
+ http_options = Util.ocs_api_request.deep_merge(Util.accept_json)
+ result = Authentication[auth_strategy].call(storage: @storage, http_options:) do |http|
+ json = yield handle_response(http.get(url))
+
+ parse_capabilities(json)
+ end
+
+ to_service_result(result)
+ end
+
+ private
+
+ def url = UrlBuilder.url(@storage.uri, "/ocs/v2.php/cloud/capabilities")
+
+ def handle_response(response)
+ error_data = StorageErrorData.new(source: self.class, payload: response.to_s)
+
+ case response
+ in { status: 200..299 }
+ Success(response.json(symbolize_keys: true))
+ in { status: 404 }
+ Failure(StorageError.new(code: :not_found,
+ log_message: "Outbound request destination not found!",
+ data: error_data))
+ else
+ Failure(StorageError.new(code: :error,
+ log_message: "Outbound request failed!",
+ data: error_data))
+ end
+ end
+
+ # rubocop:disable Metrics/AbcSize
+ def parse_capabilities(json)
+ capabilities = NextcloudCapabilities.empty
+
+ app_json = json.dig(:ocs, :data, :capabilities, :integration_openproject)
+ capabilities = capabilities.with(app_enabled?: app_json.present?)
+
+ return Success(capabilities) if app_json.nil?
+
+ app_version = yield version(app_json[:app_version])
+ group_folder_enabled = !!app_json[:groupfolders_enabled]
+ capabilities = capabilities.with(app_version:, group_folder_enabled?: group_folder_enabled)
+
+ return Success(capabilities) unless group_folder_enabled
+
+ group_folder_version = yield version(app_json[:groupfolder_version])
+ Success(capabilities.with(group_folder_version:))
+ end
+
+ # rubocop:enable Metrics/AbcSize
+
+ def version(str)
+ failure = Failure(StorageError.new(code: :error, log_message: "'#{str}' is not a valid version string"))
+
+ return failure if str.nil?
+
+ major, minor, patch = str.split(".").map(&:to_i)
+
+ return failure if major.nil? || minor.nil? || patch.nil?
+
+ Success(SemanticVersion.new(major:, minor:, patch:))
+ end
+
+ def to_service_result(result)
+ result.either(
+ ->(r) { ServiceResult.success(result: r) },
+ ->(f) { ServiceResult.failure(result: f.code, errors: f) }
+ )
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/modules/storages/app/constants/storages/nextcloud_integration.rb b/modules/storages/app/constants/storages/nextcloud_integration.rb
new file mode 100644
index 00000000000..b564ab6ef00
--- /dev/null
+++ b/modules/storages/app/constants/storages/nextcloud_integration.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module Storages
+ module NextcloudIntegration
+ MIN_APP_VERSION = "2.6.3"
+ MIN_GROUP_FOLDER_VERSION = "17.0.1"
+ end
+end
diff --git a/modules/storages/app/models/storages/nextcloud_capabilities.rb b/modules/storages/app/models/storages/nextcloud_capabilities.rb
new file mode 100644
index 00000000000..6b20c40da96
--- /dev/null
+++ b/modules/storages/app/models/storages/nextcloud_capabilities.rb
@@ -0,0 +1,40 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module Storages
+ NextcloudCapabilities = Data.define(
+ :app_enabled?,
+ :app_version,
+ :group_folder_enabled?,
+ :group_folder_version
+ ) do
+ def self.empty
+ new(app_enabled?: false, group_folder_enabled?: false, app_version: nil, group_folder_version: nil)
+ end
+ end
+end
diff --git a/modules/storages/app/models/storages/semantic_version.rb b/modules/storages/app/models/storages/semantic_version.rb
new file mode 100644
index 00000000000..75f5e62d6f0
--- /dev/null
+++ b/modules/storages/app/models/storages/semantic_version.rb
@@ -0,0 +1,54 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module Storages
+ SemanticVersion = Data.define(:major, :minor, :patch) do
+ def to_s
+ "#{major}.#{minor}.#{patch}"
+ end
+
+ def <(other)
+ major < other.major ||
+ (major == other.major && minor < other.minor) ||
+ (major == other.major && minor == other.minor && patch < other.patch)
+ end
+
+ def >(other)
+ major > other.major ||
+ (major == other.major && minor > other.minor) ||
+ (major == other.major && minor == other.minor && patch > other.patch)
+ end
+
+ def self.parse(str)
+ major, minor, patch = str.split(".").map(&:to_i)
+ SemanticVersion.new(major:, minor:, patch:)
+ end
+ end
+end
diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.yml
index 4cb3c477cc2..888ed73777f 100644
--- a/modules/storages/config/locales/en.yml
+++ b/modules/storages/config/locales/en.yml
@@ -88,6 +88,10 @@ en:
storage_delete_result_1: Remove all storage setups for all projects using this storage.
storage_delete_result_2: Remove all links from work packages of all projects to files and folders of that storage.
storage_delete_result_3: In case this storage has automatically managed project folders, those and their contained files will be deleted forever.
+ dependencies:
+ nextcloud:
+ integration_app: Integration OpenProject
+ group_folders_app: Group folders
error_invalid_provider_type: Please select a valid storage provider.
file_storage_view:
access_management:
@@ -112,11 +116,15 @@ en:
checked: Last checked %{datetime}
connection_validation:
action: Recheck connection
+ app_version_mismatch: The Integration OpenProject app version is not supported. Please update your Nextcloud server.
client_id_wrong: The configured OAuth 2 client id is invalid. Please check the configuration.
client_secret_wrong: The configured OAuth 2 client secret is invalid. Please check the configuration.
drive_id_wrong: The configured drive id could not be found. Please check the configuration.
+ host_not_found: No Nextcloud server found at the configured host url. Please check the configuration.
+ missing_dependencies: "A required dependency is missing on the file storage. Please add the following dependency: %{dependency}."
not_configured: The connection could not be validated. Please finish configuration first.
placeholder: Check your connection against the server.
+ group_folder_version_mismatch: The Group Folder version is not supported. Please update your Nextcloud server.
subtitle: Connection validation
tenant_id_wrong: The configured directory (tenant) id is invalid. Please check the configuration.
unexpected_content: Unexpected content found in the drive.
diff --git a/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rb b/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rb
new file mode 100644
index 00000000000..1f9259db9c5
--- /dev/null
+++ b/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rb
@@ -0,0 +1,156 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+require "spec_helper"
+require_module_spec_helper
+
+RSpec.describe Storages::Peripherals::NextcloudConnectionValidator do
+ before do
+ Storages::Peripherals::Registry.stub("#{storage.short_provider_type}.queries.capabilities", ->(_) { response })
+ end
+
+ subject { described_class.new(storage:).validate }
+
+ context "if storage is not yet configured" do
+ let(:storage) { create(:nextcloud_storage) }
+
+ it "returns a validation failure" do
+ expect(subject.type).to eq(:none)
+ expect(subject.error_code).to eq(:wrn_not_configured)
+ expect(subject.description).to eq("The connection could not be validated. Please finish configuration first.")
+ end
+ end
+
+ context "if nextcloud host url could not be found" do
+ let(:storage) { create(:nextcloud_storage_configured) }
+ let(:response) { build_failure(code: :not_found, payload: nil) }
+
+ it "returns a validation failure" do
+ expect(subject.type).to eq(:error)
+ expect(subject.error_code).to eq(:err_host_not_found)
+ expect(subject.description)
+ .to eq("No Nextcloud server found at the configured host url. Please check the configuration.")
+ end
+ end
+
+ context "if request returns a capabilities response" do
+ let(:storage) { create(:nextcloud_storage_configured) }
+ let(:app_enabled) { true }
+ let(:app_version) { Storages::SemanticVersion.parse("2.6.3") }
+ let(:group_folder_enabled) { true }
+ let(:group_folder_version) { Storages::SemanticVersion.parse("17.0.1") }
+ let(:response) do
+ ServiceResult.success(result: Storages::NextcloudCapabilities.new(
+ app_enabled?: app_enabled,
+ app_version:,
+ group_folder_enabled?: group_folder_enabled,
+ group_folder_version:
+ ))
+ end
+
+ it "returns a healthy validation" do
+ expect(subject.type).to eq(:healthy)
+ expect(subject.error_code).to eq(:none)
+ end
+
+ context "if nextcloud server instance is badly configured" do
+ context "with missing integration app" do
+ let(:app_enabled) { false }
+
+ it "returns a validation failure" do
+ expect(subject.type).to eq(:error)
+ expect(subject.error_code).to eq(:err_missing_dependencies)
+ expect(subject.description).to eq("A required dependency is missing on the file storage. " \
+ "Please add the following dependency: Integration OpenProject.")
+ end
+ end
+
+ context "with outdated integration app" do
+ let(:app_version) { Storages::SemanticVersion.parse("2.4.3") }
+
+ it "returns a validation failure" do
+ expect(subject.type).to eq(:error)
+ expect(subject.error_code).to eq(:err_unexpected_version)
+ expect(subject.description)
+ .to eq("The Integration OpenProject app version is not supported. Please update your Nextcloud server.")
+ end
+ end
+
+ context "with disabled/not installed group folder app" do
+ let(:group_folder_enabled) { false }
+
+ it "returns a validation failure" do
+ expect(subject.type).to eq(:error)
+ expect(subject.error_code).to eq(:err_missing_dependencies)
+ expect(subject.description).to eq("A required dependency is missing on the file storage. " \
+ "Please add the following dependency: Group folders.")
+ end
+ end
+
+ context "with outdated group folder app" do
+ let(:group_folder_version) { Storages::SemanticVersion.parse("16.0.1") }
+
+ it "returns a validation failure" do
+ expect(subject.type).to eq(:error)
+ expect(subject.error_code).to eq(:err_unexpected_version)
+ expect(subject.description)
+ .to eq("The Group Folder version is not supported. Please update your Nextcloud server.")
+ end
+ end
+ end
+ end
+
+ context "if query returns an unhandled error" do
+ let(:storage) { create(:nextcloud_storage_configured) }
+ let(:response) { build_failure(code: :error, payload: nil) }
+
+ before do
+ allow(Rails.logger).to receive(:error)
+ end
+
+ it "returns a validation failure" do
+ expect(subject.type).to eq(:error)
+ expect(subject.error_code).to eq(:err_unknown)
+ expect(subject.description).to eq("The connection could not be validated. An unknown error occurred. " \
+ "Please check the server logs for further information.")
+ end
+
+ it "logs the error message" do
+ described_class.new(storage:).validate
+ expect(Rails.logger).to have_received(:error).with(/Connection validation failed with unknown error/)
+ end
+ end
+
+ private
+
+ def build_failure(code:, payload:)
+ data = Storages::StorageErrorData.new(source: "query", payload:)
+ error = Storages::StorageError.new(code:, data:)
+ ServiceResult.failure(result: code, errors: error)
+ end
+end
diff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/capabilities_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/capabilities_query_spec.rb
new file mode 100644
index 00000000000..c3d124606de
--- /dev/null
+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/capabilities_query_spec.rb
@@ -0,0 +1,117 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+require "spec_helper"
+require_module_spec_helper
+
+RSpec.describe Storages::Peripherals::StorageInteraction::Nextcloud::CapabilitiesQuery, :webmock do
+ let(:user) { create(:user) }
+ let(:storage) do
+ create(:nextcloud_storage_with_local_connection, :as_not_automatically_managed, oauth_client_token_user: user)
+ end
+ let(:auth_strategy) do
+ Storages::Peripherals::StorageInteraction::AuthenticationStrategies::Noop.strategy
+ end
+
+ it "is registered as queries.capabilities" do
+ expect(Storages::Peripherals::Registry.resolve("nextcloud.queries.capabilities")).to eq(described_class)
+ end
+
+ it "responds to #call with correct parameters" do
+ expect(described_class).to respond_to(:call)
+
+ method = described_class.method(:call)
+ expect(method.parameters).to contain_exactly(%i[keyreq storage], %i[keyreq auth_strategy])
+ end
+
+ shared_examples_for "a successful Nextcloud capabilities response" do
+ it "returns a capabilities object" do
+ result = described_class.call(storage:, auth_strategy:)
+
+ expect(result).to be_success
+
+ response = result.result
+ expect(response).to be_a(Storages::NextcloudCapabilities)
+ expect(response.app_enabled?).to eq(app_enabled?)
+ expect(response.app_version).to eq(app_version)
+ expect(response.group_folder_enabled?).to eq(group_folder_enabled?)
+ expect(response.group_folder_version).to eq(group_folder_version)
+ end
+ end
+
+ context "if both apps are installed", vcr: "nextcloud/capabilities_success" do
+ let(:app_enabled?) { true }
+ let(:app_version) { Storages::SemanticVersion.parse("2.6.3") }
+ let(:group_folder_enabled?) { true }
+ let(:group_folder_version) { Storages::SemanticVersion.parse("16.0.7") }
+
+ it_behaves_like "a successful Nextcloud capabilities response"
+ end
+
+ context "if group folder app is installed but disabled", vcr: "nextcloud/capabilities_success_group_folder_disabled" do
+ let(:app_enabled?) { true }
+ let(:app_version) { Storages::SemanticVersion.parse("2.6.3") }
+ let(:group_folder_enabled?) { false }
+ let(:group_folder_version) { nil }
+
+ it_behaves_like "a successful Nextcloud capabilities response"
+ end
+
+ context "if group folder app is not installed", vcr: "nextcloud/capabilities_success_group_folder_not_installed" do
+ let(:app_enabled?) { true }
+ let(:app_version) { Storages::SemanticVersion.parse("2.6.3") }
+ let(:group_folder_enabled?) { false }
+ let(:group_folder_version) { nil }
+
+ it_behaves_like "a successful Nextcloud capabilities response"
+ end
+
+ context "if integration app is not installed", vcr: "nextcloud/capabilities_success_app_disabled" do
+ let(:app_enabled?) { false }
+ let(:app_version) { nil }
+ let(:group_folder_enabled?) { false }
+ let(:group_folder_version) { nil }
+
+ it_behaves_like "a successful Nextcloud capabilities response"
+ end
+
+ context "if response contains invalid version data", vcr: "nextcloud/capabilities_invalid_data" do
+ it "returns a failure" do
+ result = described_class.call(storage:, auth_strategy:)
+
+ expect(result).to be_failure
+
+ error = result.errors
+ expect(error).to be_a(Storages::StorageError)
+ expect(error.code).to eq(:error)
+ expect(error.log_message).to include("not a valid version string")
+ end
+ end
+end
diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/capabilities_invalid_data.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/capabilities_invalid_data.yml
new file mode 100644
index 00000000000..f85b1828822
--- /dev/null
+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/capabilities_invalid_data.yml
@@ -0,0 +1,76 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: https://nextcloud.local/ocs/v2.php/cloud/capabilities
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Ocs-Apirequest:
+ - 'true'
+ Accept:
+ - application/json
+ User-Agent:
+ - httpx.rb/1.3.0
+ Accept-Encoding:
+ - gzip, deflate
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Cache-Control:
+ - no-cache, no-store, must-revalidate
+ Content-Encoding:
+ - gzip
+ Content-Security-Policy:
+ - default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'
+ Content-Type:
+ - application/json; charset=utf-8
+ Date:
+ - Thu, 18 Jul 2024 11:27:28 GMT
+ Etag:
+ - '"328cf79596a6eade9a5da377e294686a"'
+ Expires:
+ - Thu, 19 Nov 1981 08:52:00 GMT
+ Feature-Policy:
+ - autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone
+ 'none';payment 'none'
+ Pragma:
+ - no-cache
+ Referrer-Policy:
+ - no-referrer
+ Server:
+ - Apache/2.4.59 (Debian)
+ Set-Cookie:
+ - oc07ul6b4oaw=ac95f5dc441c864959b9d9de28b2eff5; path=/; secure; HttpOnly; SameSite=Lax,
+ oc_sessionPassphrase=ibjWW7o%2BVKNDYidS7AFrxFEtH8dCDXWP%2Fus2cuRh8YZOVbBBQ%2Blke092X%2FPVJWGi0t2M6QwLBaOTdPDJE6yWwtkzj0wIzrhQtJ2VjDb98uubBBEly2w9Vq1U59HnBEtA;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=ac95f5dc441c864959b9d9de28b2eff5;
+ path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true;
+ path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax,
+ __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,
+ 31-Dec-2100 23:59:59 GMT; SameSite=strict, oc07ul6b4oaw=ac95f5dc441c864959b9d9de28b2eff5;
+ path=/; secure; HttpOnly; SameSite=Lax
+ X-Content-Type-Options:
+ - nosniff
+ X-Frame-Options:
+ - SAMEORIGIN
+ X-Permitted-Cross-Domain-Policies:
+ - none
+ X-Powered-By:
+ - PHP/8.2.21
+ X-Request-Id:
+ - Rbnuaj6ijUpXxTzVgnDf
+ X-Robots-Tag:
+ - noindex, nofollow
+ X-Xss-Protection:
+ - 1; mode=block
+ Content-Length:
+ - '417'
+ body:
+ encoding: UTF-8
+ string: '{"ocs":{"meta":{"status":"ok","statuscode":200,"message":"OK"},"data":{"version":{"major":28,"minor":0,"micro":7,"string":"28.0.7","edition":"","extendedSupport":false},"capabilities":{"bruteforce":{"delay":0,"allow-listed":false},"integration_openproject":{"app_version":"2.6","groupfolder_version":"16.0.7","groupfolders_enabled":true},"theming":{"name":"Nextcloud","url":"https:\/\/nextcloud.com","slogan":"a
+ safe home for all your data","color":"#00679e","color-text":"#ffffff","color-element":"#00679e","color-element-bright":"#00679e","color-element-dark":"#00679e","logo":"https:\/\/nextcloud.local\/core\/img\/logo\/logo.svg?v=0","background":"#00679e","background-plain":true,"background-default":true,"logoheader":"https:\/\/nextcloud.local\/core\/img\/logo\/logo.svg?v=0","favicon":"https:\/\/nextcloud.local\/core\/img\/logo\/logo.svg?v=0"}}}}}'
+ recorded_at: Thu, 18 Jul 2024 11:27:28 GMT
+recorded_with: VCR 6.2.0
diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/capabilities_success.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/capabilities_success.yml
new file mode 100644
index 00000000000..aa5685c1c28
--- /dev/null
+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/capabilities_success.yml
@@ -0,0 +1,76 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: https://nextcloud.local/ocs/v2.php/cloud/capabilities
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Ocs-Apirequest:
+ - 'true'
+ Accept:
+ - application/json
+ User-Agent:
+ - httpx.rb/1.3.0
+ Accept-Encoding:
+ - gzip, deflate
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Cache-Control:
+ - no-cache, no-store, must-revalidate
+ Content-Encoding:
+ - gzip
+ Content-Security-Policy:
+ - default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'
+ Content-Type:
+ - application/json; charset=utf-8
+ Date:
+ - Thu, 18 Jul 2024 08:57:07 GMT
+ Etag:
+ - '"328cf79596a6eade9a5da377e294686a"'
+ Expires:
+ - Thu, 19 Nov 1981 08:52:00 GMT
+ Feature-Policy:
+ - autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone
+ 'none';payment 'none'
+ Pragma:
+ - no-cache
+ Referrer-Policy:
+ - no-referrer
+ Server:
+ - Apache/2.4.59 (Debian)
+ Set-Cookie:
+ - oc07ul6b4oaw=76b8c10bb977857fd9d56abef2597ec5; path=/; secure; HttpOnly; SameSite=Lax,
+ oc_sessionPassphrase=Gd9JM7TDJ13onBvlTB0kqyy4QOXR%2BYC2rNIxNJ3D8rTJ5icjbnIzFgr7ju%2BDsXDP2KgRhScjQwJa9XN2f9jnU6q22i3I28bwAhsEr%2Fu2h6qQefim7sGVNv7CE3jbmG5A;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=76b8c10bb977857fd9d56abef2597ec5;
+ path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true;
+ path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax,
+ __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,
+ 31-Dec-2100 23:59:59 GMT; SameSite=strict, oc07ul6b4oaw=76b8c10bb977857fd9d56abef2597ec5;
+ path=/; secure; HttpOnly; SameSite=Lax
+ X-Content-Type-Options:
+ - nosniff
+ X-Frame-Options:
+ - SAMEORIGIN
+ X-Permitted-Cross-Domain-Policies:
+ - none
+ X-Powered-By:
+ - PHP/8.2.21
+ X-Request-Id:
+ - dGaGYNvKWscYt8Ag8Okz
+ X-Robots-Tag:
+ - noindex, nofollow
+ X-Xss-Protection:
+ - 1; mode=block
+ Content-Length:
+ - '417'
+ body:
+ encoding: UTF-8
+ string: '{"ocs":{"meta":{"status":"ok","statuscode":200,"message":"OK"},"data":{"version":{"major":28,"minor":0,"micro":7,"string":"28.0.7","edition":"","extendedSupport":false},"capabilities":{"bruteforce":{"delay":0,"allow-listed":false},"integration_openproject":{"app_version":"2.6.3","groupfolder_version":"16.0.7","groupfolders_enabled":true},"theming":{"name":"Nextcloud","url":"https:\/\/nextcloud.com","slogan":"a
+ safe home for all your data","color":"#00679e","color-text":"#ffffff","color-element":"#00679e","color-element-bright":"#00679e","color-element-dark":"#00679e","logo":"https:\/\/nextcloud.local\/core\/img\/logo\/logo.svg?v=0","background":"#00679e","background-plain":true,"background-default":true,"logoheader":"https:\/\/nextcloud.local\/core\/img\/logo\/logo.svg?v=0","favicon":"https:\/\/nextcloud.local\/core\/img\/logo\/logo.svg?v=0"}}}}}'
+ recorded_at: Thu, 18 Jul 2024 08:57:07 GMT
+recorded_with: VCR 6.2.0
diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/capabilities_success_app_disabled.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/capabilities_success_app_disabled.yml
new file mode 100644
index 00000000000..5ba43df5d47
--- /dev/null
+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/capabilities_success_app_disabled.yml
@@ -0,0 +1,76 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: https://nextcloud.local/ocs/v2.php/cloud/capabilities
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Ocs-Apirequest:
+ - 'true'
+ Accept:
+ - application/json
+ User-Agent:
+ - httpx.rb/1.3.0
+ Accept-Encoding:
+ - gzip, deflate
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Cache-Control:
+ - no-cache, no-store, must-revalidate
+ Content-Encoding:
+ - gzip
+ Content-Security-Policy:
+ - default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'
+ Content-Type:
+ - application/json; charset=utf-8
+ Date:
+ - Thu, 18 Jul 2024 11:08:36 GMT
+ Etag:
+ - '"239fbef50c9f726dacc27b3926f1d412"'
+ Expires:
+ - Thu, 19 Nov 1981 08:52:00 GMT
+ Feature-Policy:
+ - autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone
+ 'none';payment 'none'
+ Pragma:
+ - no-cache
+ Referrer-Policy:
+ - no-referrer
+ Server:
+ - Apache/2.4.59 (Debian)
+ Set-Cookie:
+ - oc07ul6b4oaw=7dd57f7df2fa9182f35293e790df04a1; path=/; secure; HttpOnly; SameSite=Lax,
+ oc_sessionPassphrase=dVTC6oN%2BeR3PuEQS%2BU3uzQX3yIJhJ7J1vxp%2FeyONfXYZYynSBd34QQrUxywFobEaXG6obJNNgYiybQsBBIggx10OEgJDIriDcrPkj4gX9P4KubUIPMHjknt6eD7opePa;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=7dd57f7df2fa9182f35293e790df04a1;
+ path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true;
+ path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax,
+ __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,
+ 31-Dec-2100 23:59:59 GMT; SameSite=strict, oc07ul6b4oaw=7dd57f7df2fa9182f35293e790df04a1;
+ path=/; secure; HttpOnly; SameSite=Lax
+ X-Content-Type-Options:
+ - nosniff
+ X-Frame-Options:
+ - SAMEORIGIN
+ X-Permitted-Cross-Domain-Policies:
+ - none
+ X-Powered-By:
+ - PHP/8.2.21
+ X-Request-Id:
+ - uIXexPMfV1NwH11Oak9M
+ X-Robots-Tag:
+ - noindex, nofollow
+ X-Xss-Protection:
+ - 1; mode=block
+ Content-Length:
+ - '362'
+ body:
+ encoding: UTF-8
+ string: '{"ocs":{"meta":{"status":"ok","statuscode":200,"message":"OK"},"data":{"version":{"major":28,"minor":0,"micro":7,"string":"28.0.7","edition":"","extendedSupport":false},"capabilities":{"bruteforce":{"delay":0,"allow-listed":false},"theming":{"name":"Nextcloud","url":"https:\/\/nextcloud.com","slogan":"a
+ safe home for all your data","color":"#00679e","color-text":"#ffffff","color-element":"#00679e","color-element-bright":"#00679e","color-element-dark":"#00679e","logo":"https:\/\/nextcloud.local\/core\/img\/logo\/logo.svg?v=0","background":"#00679e","background-plain":true,"background-default":true,"logoheader":"https:\/\/nextcloud.local\/core\/img\/logo\/logo.svg?v=0","favicon":"https:\/\/nextcloud.local\/core\/img\/logo\/logo.svg?v=0"}}}}}'
+ recorded_at: Thu, 18 Jul 2024 11:08:36 GMT
+recorded_with: VCR 6.2.0
diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/capabilities_success_group_folder_disabled.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/capabilities_success_group_folder_disabled.yml
new file mode 100644
index 00000000000..612fd14c4d0
--- /dev/null
+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/capabilities_success_group_folder_disabled.yml
@@ -0,0 +1,76 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: https://nextcloud.local/ocs/v2.php/cloud/capabilities
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Ocs-Apirequest:
+ - 'true'
+ Accept:
+ - application/json
+ User-Agent:
+ - httpx.rb/1.3.0
+ Accept-Encoding:
+ - gzip, deflate
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Cache-Control:
+ - no-cache, no-store, must-revalidate
+ Content-Encoding:
+ - gzip
+ Content-Security-Policy:
+ - default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'
+ Content-Type:
+ - application/json; charset=utf-8
+ Date:
+ - Thu, 18 Jul 2024 11:03:34 GMT
+ Etag:
+ - '"c119e7d82627717e256e18ebeb5a373a"'
+ Expires:
+ - Thu, 19 Nov 1981 08:52:00 GMT
+ Feature-Policy:
+ - autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone
+ 'none';payment 'none'
+ Pragma:
+ - no-cache
+ Referrer-Policy:
+ - no-referrer
+ Server:
+ - Apache/2.4.59 (Debian)
+ Set-Cookie:
+ - oc07ul6b4oaw=1729d5dbb89b62a4132f46acf43558a1; path=/; secure; HttpOnly; SameSite=Lax,
+ oc_sessionPassphrase=H1KAN20C45teGnwLZGTYBHy3x00lrymWoytW5%2Bvj0MVmazjcRgqEs3NcJtHTOFtpbVXT%2F8zagj7hncZa9KecKC2Xr5wpK%2Fbx38iPge111TrXgASaeFlCDhklF2r2wLIi;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=1729d5dbb89b62a4132f46acf43558a1;
+ path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true;
+ path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax,
+ __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,
+ 31-Dec-2100 23:59:59 GMT; SameSite=strict, oc07ul6b4oaw=1729d5dbb89b62a4132f46acf43558a1;
+ path=/; secure; HttpOnly; SameSite=Lax
+ X-Content-Type-Options:
+ - nosniff
+ X-Frame-Options:
+ - SAMEORIGIN
+ X-Permitted-Cross-Domain-Policies:
+ - none
+ X-Powered-By:
+ - PHP/8.2.21
+ X-Request-Id:
+ - fcmifMx3JEdm3Zl2pdUo
+ X-Robots-Tag:
+ - noindex, nofollow
+ X-Xss-Protection:
+ - 1; mode=block
+ Content-Length:
+ - '415'
+ body:
+ encoding: UTF-8
+ string: '{"ocs":{"meta":{"status":"ok","statuscode":200,"message":"OK"},"data":{"version":{"major":28,"minor":0,"micro":7,"string":"28.0.7","edition":"","extendedSupport":false},"capabilities":{"bruteforce":{"delay":0,"allow-listed":false},"integration_openproject":{"app_version":"2.6.3","groupfolder_version":"16.0.7","groupfolders_enabled":false},"theming":{"name":"Nextcloud","url":"https:\/\/nextcloud.com","slogan":"a
+ safe home for all your data","color":"#00679e","color-text":"#ffffff","color-element":"#00679e","color-element-bright":"#00679e","color-element-dark":"#00679e","logo":"https:\/\/nextcloud.local\/core\/img\/logo\/logo.svg?v=0","background":"#00679e","background-plain":true,"background-default":true,"logoheader":"https:\/\/nextcloud.local\/core\/img\/logo\/logo.svg?v=0","favicon":"https:\/\/nextcloud.local\/core\/img\/logo\/logo.svg?v=0"}}}}}'
+ recorded_at: Thu, 18 Jul 2024 11:03:34 GMT
+recorded_with: VCR 6.2.0
diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/capabilities_success_group_folder_not_installed.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/capabilities_success_group_folder_not_installed.yml
new file mode 100644
index 00000000000..4d600898549
--- /dev/null
+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/capabilities_success_group_folder_not_installed.yml
@@ -0,0 +1,76 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: https://nextcloud.local/ocs/v2.php/cloud/capabilities
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Ocs-Apirequest:
+ - 'true'
+ Accept:
+ - application/json
+ User-Agent:
+ - httpx.rb/1.3.0
+ Accept-Encoding:
+ - gzip, deflate
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Cache-Control:
+ - no-cache, no-store, must-revalidate
+ Content-Encoding:
+ - gzip
+ Content-Security-Policy:
+ - default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'
+ Content-Type:
+ - application/json; charset=utf-8
+ Date:
+ - Thu, 18 Jul 2024 11:04:56 GMT
+ Etag:
+ - '"cb9d88604825c4ca8e42384551d66f28"'
+ Expires:
+ - Thu, 19 Nov 1981 08:52:00 GMT
+ Feature-Policy:
+ - autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone
+ 'none';payment 'none'
+ Pragma:
+ - no-cache
+ Referrer-Policy:
+ - no-referrer
+ Server:
+ - Apache/2.4.59 (Debian)
+ Set-Cookie:
+ - oc07ul6b4oaw=bd23100f696f55051bfee2ff15d3cbfd; path=/; secure; HttpOnly; SameSite=Lax,
+ oc_sessionPassphrase=cSLykfoaovW6EbAMcb1P6Jl2ZMcYYFJc0BJo%2FLXtcroiV5r85nDBdqoimwNV%2FO46kYnSlJVaYggWqQ%2FOC%2FibYBwVhFkjGxYdjpEV6bM%2BHqJrGEKf7GxpnSV7DXdebO6t;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=bd23100f696f55051bfee2ff15d3cbfd;
+ path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true;
+ path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax,
+ __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,
+ 31-Dec-2100 23:59:59 GMT; SameSite=strict, oc07ul6b4oaw=bd23100f696f55051bfee2ff15d3cbfd;
+ path=/; secure; HttpOnly; SameSite=Lax
+ X-Content-Type-Options:
+ - nosniff
+ X-Frame-Options:
+ - SAMEORIGIN
+ X-Permitted-Cross-Domain-Policies:
+ - none
+ X-Powered-By:
+ - PHP/8.2.21
+ X-Request-Id:
+ - ANrlcdmO8jMyDh942KTq
+ X-Robots-Tag:
+ - noindex, nofollow
+ X-Xss-Protection:
+ - 1; mode=block
+ Content-Length:
+ - '411'
+ body:
+ encoding: UTF-8
+ string: '{"ocs":{"meta":{"status":"ok","statuscode":200,"message":"OK"},"data":{"version":{"major":28,"minor":0,"micro":7,"string":"28.0.7","edition":"","extendedSupport":false},"capabilities":{"bruteforce":{"delay":0,"allow-listed":false},"integration_openproject":{"app_version":"2.6.3","groupfolder_version":"0","groupfolders_enabled":false},"theming":{"name":"Nextcloud","url":"https:\/\/nextcloud.com","slogan":"a
+ safe home for all your data","color":"#00679e","color-text":"#ffffff","color-element":"#00679e","color-element-bright":"#00679e","color-element-dark":"#00679e","logo":"https:\/\/nextcloud.local\/core\/img\/logo\/logo.svg?v=0","background":"#00679e","background-plain":true,"background-default":true,"logoheader":"https:\/\/nextcloud.local\/core\/img\/logo\/logo.svg?v=0","favicon":"https:\/\/nextcloud.local\/core\/img\/logo\/logo.svg?v=0"}}}}}'
+ recorded_at: Thu, 18 Jul 2024 11:04:56 GMT
+recorded_with: VCR 6.2.0