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

Correctly indicate valid configuration for SSO-only cases

Jan Sandbrink9ff68c6f566e
diff --git a/modules/storages/app/models/storages/nextcloud_storage.rb b/modules/storages/app/models/storages/nextcloud_storage.rb
index 2df3d807c74..05af29059f7 100644
--- a/modules/storages/app/models/storages/nextcloud_storage.rb
+++ b/modules/storages/app/models/storages/nextcloud_storage.rb
@@ -80,8 +80,8 @@ module Storages
def configuration_checks
{
- storage_oauth_client_configured: oauth_client.present?,
- openproject_oauth_application_configured: oauth_application.present?,
+ storage_oauth_client_configured: !authenticate_via_storage? || oauth_client.present?,
+ openproject_oauth_application_configured: !authenticate_via_storage? || oauth_application.present?,
host_name_configured: host.present? && name.present?,
nextcloud_audience_configured: !authenticate_via_idp? || nextcloud_audience.present?
}
diff --git a/modules/storages/spec/models/storages/nextcloud_storage_spec.rb b/modules/storages/spec/models/storages/nextcloud_storage_spec.rb
index ec83f266aa7..884dd047596 100644
--- a/modules/storages/spec/models/storages/nextcloud_storage_spec.rb
+++ b/modules/storages/spec/models/storages/nextcloud_storage_spec.rb
@@ -133,6 +133,23 @@ RSpec.describe Storages::NextcloudStorage do
expect(storage.configuration_checks[:storage_oauth_client_configured]).to be(false)
end
end
+
+ context "when storage authenticates through IDP" do
+ let(:storage) do
+ build(:nextcloud_storage,
+ authentication_method: "oauth2_sso",
+ nextcloud_audience: "some")
+ end
+
+ it "returns true" do
+ expect(storage.configured?).to be(true)
+
+ aggregate_failures "configuration_checks" do
+ expect(storage.configuration_checks[:openproject_oauth_application_configured]).to be(true)
+ expect(storage.configuration_checks[:storage_oauth_client_configured]).to be(true)
+ end
+ end
+ end
end
end