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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Storage Health Check: OIDC Provisioned Current User (#17940)
Marcello Rochab8c89a0f933f
diff --git a/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rb b/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rbindex 7e497785ebd..f989a56888e 100644--- a/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rb+++ b/modules/storages/app/common/storages/peripherals/nextcloud_connection_validator.rb@@ -58,7 +58,7 @@ module Storagesdef sso_misconfiguredreturn None() unless @storage.authenticate_via_idp?- audience_missing.or { non_provisioned_user }+ audience_missing.or { non_provisioned_user }.or { non_oidc_provisioned_user }enddef audience_missing@@ -71,7 +71,7 @@ module Storagesenddef non_provisioned_user- return None() if @user.authentication_provider.present?+ return None() if @user.identity_url.present?Some(ConnectionValidation.new(type: :warning,error_code: :oidc_non_provisioned_user,@@ -79,6 +79,15 @@ module Storagesdescription: I18n.t("storages.health.connection_validation.oidc_non_provisioned_user")))end+ def non_oidc_provisioned_user+ return None() if @user.authentication_provider.is_a?(OpenIDConnect::Provider)++ Some(ConnectionValidation.new(type: :warning,+ error_code: :oidc_non_oidc_user,+ timestamp: Time.current,+ description: I18n.t("storages.health.connection_validation.oidc_non_oidc_user")))+ end+def has_base_configuration_error?host_url_not_found.or { missing_dependencies }diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.ymlindex 3c3035fef21..1d87ee7fa9a 100644--- a/modules/storages/config/locales/en.yml+++ b/modules/storages/config/locales/en.yml@@ -224,6 +224,7 @@ en: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.oidc_audience_missing: The storage has no audience defined. This is necessary for OpenID Connect integration.+ oidc_non_oidc_user: The current user, while provisioned, wasn't provisioned by an OpenID Connect (OIDC) Identity Provider. Please re-run the check with an OIDC provisioned user.oidc_non_provisioned_user: The current user isn't provided by an OpenID Connect Identity Provider. Please re-run the check with a provided user.placeholder: Check your connection against the server.subtitle: Connection validationdiff --git a/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rb b/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rbindex 7f52b478cc3..8b4ec06c136 100644--- a/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rb+++ b/modules/storages/spec/common/storages/peripherals/nextcloud_connection_validator_spec.rb@@ -267,6 +267,14 @@ RSpec.describe Storages::Peripherals::NextcloudConnectionValidator doexpect(subject.error_code).to eq(:oidc_non_provisioned_user)expect(subject.description).to eq(I18n.t("storages.health.connection_validation.oidc_non_provisioned_user"))end++ it "returns a warning if the user is not provided by an oidc provider" do+ user.update(identity_url: "ldap-provider:this-will-trigger-a-warning")++ expect(subject.type).to eq(:warning)+ expect(subject.error_code).to eq(:oidc_non_oidc_user)+ expect(subject.description).to eq(I18n.t("storages.health.connection_validation.oidc_non_oidc_user"))+ endendprivate