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
[#61659] fix stuff for nextcloud hub scenario
Eric Schubert8a46e77d3d30
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rbindex 9595353b8ab..c592e65b22f 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/authentication.rb@@ -59,7 +59,7 @@ module Storages# - :failed_authorization If a user token is available, which is invalid and not refreshable# - :error If an unexpected error occurreddef self.authorization_state(storage:, user:)- auth_strategy = AuthenticationStrategies::OAuthUserToken.strategy.with_user(user)+ auth_strategy = Registry.resolve("#{storage}.authentication.user_bound").call(user:, storage:)Registry.resolve("#{storage}.queries.user")diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/util.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/util.rbindex e04c5c1ef23..2888c25fd8e 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/util.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/util.rb@@ -70,7 +70,7 @@ module Storagescase auth_strategy.keywhen :basic_authServiceResult.success(result: storage.username)- when :oauth_user_token || :sso_user_token+ when :oauth_user_token, :sso_user_tokenorigin_user_id = RemoteIdentity.where(user_id: auth_strategy.user, oauth_client: storage.oauth_client).pick(:origin_user_id)if origin_user_id.present?diff --git a/modules/storages/app/models/storages/one_drive_storage.rb b/modules/storages/app/models/storages/one_drive_storage.rbindex aff7f7c877f..f215f0079fc 100644--- a/modules/storages/app/models/storages/one_drive_storage.rb+++ b/modules/storages/app/models/storages/one_drive_storage.rb@@ -69,6 +69,14 @@ module Storagesnilend+ def authenticate_via_idp?+ false+ end++ def authenticate_via_storage?+ true+ end+def oauth_configurationPeripherals::OAuthConfigurations::OneDriveConfiguration.new(self)enddiff --git a/modules/storages/app/models/storages/project_storage.rb b/modules/storages/app/models/storages/project_storage.rbindex 5eee6413f30..6d33c1b2942 100644--- a/modules/storages/app/models/storages/project_storage.rb+++ b/modules/storages/app/models/storages/project_storage.rb@@ -99,15 +99,9 @@ module Storagesdef open_with_connection_ensuredreturn unless storage.configured?+ return open_project_storage_url if storage.authenticate_via_idp?- url_helpers = OpenProject::StaticRouting::StaticRouter.new.url_helpers- open_project_storage_url = url_helpers.open_project_storage_url(- host: Setting.host_name,- protocol: "https",- project_id: project.identifier,- id:- )- url_helpers.oauth_clients_ensure_connection_path(+ OpenProject::StaticRouting::StaticRouter.new.url_helpers.oauth_clients_ensure_connection_path(oauth_client_id: storage.oauth_client.client_id,storage_id: storage.id,destination_url: open_project_storage_url@@ -116,6 +110,15 @@ module Storagesprivate+ def open_project_storage_url+ OpenProject::StaticRouting::StaticRouter+ .new+ .url_helpers.open_project_storage_url(host: Setting.host_name,+ protocol: "https",+ project_id: project.identifier,+ id:)+ end+def managed_folder_identifier@managed_folder_identifier ||=Peripherals::Registry.resolve("#{storage}.models.managed_folder_identifier").new(self)diff --git a/modules/storages/app/models/storages/storage.rb b/modules/storages/app/models/storages/storage.rbindex 7ccee78c7f2..09b765d3a76 100644--- a/modules/storages/app/models/storages/storage.rb+++ b/modules/storages/app/models/storages/storage.rb@@ -154,6 +154,14 @@ module Storagesraise Errors::SubclassResponsibilityend+ def authenticate_via_idp?+ raise Errors::SubclassResponsibility+ end++ def authenticate_via_storage?+ raise Errors::SubclassResponsibility+ end+def configured?configuration_checks.values.all?end