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
MInor bugfixes on Sharepoint Storage (#20030)
Marcello Rocha01c22cdd7e40
diff --git a/config/static_links.yml b/config/static_links.ymlindex 8885b128ede..a6ee918f8a7 100644--- a/config/static_links.yml+++ b/config/static_links.yml@@ -149,11 +149,11 @@ storage_docs:href: https://portal.azure.com/one_drive_setup:href: https://www.openproject.org/docs/system-admin-guide/integrations/one-drive/- share_point_drive_id_guide:+ sharepoint_drive_id_guide:href: https://www.openproject.org/docs/system-admin-guide/integrations/one-drive/drive-guide/- share_point_oauth_application:+ sharepoint_oauth_application:href: https://portal.azure.com/- share_point_setup:+ sharepoint_setup:href: https://www.openproject.org/docs/system-admin-guide/integrations/one-drive/troubleshooting:href: https://www.openproject.org/docs/user-guide/file-management/nextcloud-integration/#possible-errors-and-troubleshootingdiff --git a/modules/storages/app/common/storages/adapters/providers/sharepoint/storage_wizard.rb b/modules/storages/app/common/storages/adapters/providers/sharepoint/storage_wizard.rbindex dfecea8f3e3..e03051363cc 100644--- a/modules/storages/app/common/storages/adapters/providers/sharepoint/storage_wizard.rb+++ b/modules/storages/app/common/storages/adapters/providers/sharepoint/storage_wizard.rb@@ -35,11 +35,6 @@ module Storagesclass StorageWizard < Wizardstep :general_information, completed_if: ->(storage) { storage.name.present? }- step :access_management,- section: :access_management_section,- completed_if: ->(storage) { !storage.automatic_management_unspecified? },- preparation: :prepare_storage_for_access_management_form-step :oauth_client,section: :oauth_configuration,completed_if: ->(storage) { storage.oauth_client.present? },@@ -53,22 +48,10 @@ module Storagesprivate- def prepare_storage_for_access_management_form(storage)- ::Storages::Storages::SetProviderFieldsAttributesService- .new(user:, model: storage, contract_class: EmptyContract)- .call- end-def prepare_oauth_application(storage)persist_service_result = ::Storages::OAuthApplications::CreateService.new(storage:, user:).callstorage.oauth_application = persist_service_result.result if persist_service_result.success?end-- def prepare_storage_for_automatic_management_form(storage)- ::Storages::Storages::SetProviderFieldsAttributesService- .new(user:, model: storage, contract_class: EmptyContract)- .call- endendendenddiff --git a/modules/storages/app/helpers/storages/open_storage_links.rb b/modules/storages/app/helpers/storages/open_storage_links.rbindex 557e7e73350..8f720952ea3 100644--- a/modules/storages/app/helpers/storages/open_storage_links.rb+++ b/modules/storages/app/helpers/storages/open_storage_links.rb@@ -39,7 +39,7 @@ module Storagescase storagewhen NextcloudStorageapi_static_link- when OneDriveStorage+ when OneDriveStorage, SharepointStorageraise Errors::ConfigurationError, "No OAuth credential information configured." if storage.oauth_client.nil?oauth_clients_ensure_connection_url(@@ -56,7 +56,7 @@ module Storagescase storagewhen NextcloudStoragetrue- when OneDriveStorage+ when OneDriveStorage, SharepointStoragestorage.oauth_client&.persisted?elsefalsediff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.ymlindex ee6c0ea7d55..44a9ade8a77 100644--- a/modules/storages/config/locales/en.yml+++ b/modules/storages/config/locales/en.yml@@ -237,6 +237,7 @@ en:openproject_oauth: OpenProject OAuthproject_folders: Project foldersredirect_uri: Redirect URI+ sharepoint_oauth: Azure OAuthstorage_audience_blank: No audience has been configured.storage_audience_description: Exchanging tokens for audience "%{audience}".storage_audience_idp: Using access token obtained by identity provider during login, regardless of audience.@@ -279,6 +280,7 @@ en:drive_id_exists: Drive existsdrive_id_format: Drive ID formatheader: Configuration+ host: Host URLhost_url_accessible: Host URL accessiblestorage_configured: Configuration completetenant_id: Tenant IDdiff --git a/modules/storages/spec/common/storages/adapters/providers/sharepoint/storage_wizard_spec.rb b/modules/storages/spec/common/storages/adapters/providers/sharepoint/storage_wizard_spec.rbindex 9a593525560..9383af69911 100644--- a/modules/storages/spec/common/storages/adapters/providers/sharepoint/storage_wizard_spec.rb+++ b/modules/storages/spec/common/storages/adapters/providers/sharepoint/storage_wizard_spec.rb@@ -46,7 +46,6 @@ RSpec.describe Storages::Adapters::Providers::Sharepoint::StorageWizard doit "has all steps pending in correct order" doexpect(wizard.pending_steps).to eq(%i[general_information- access_managementoauth_clientredirect_uri])end@@ -70,49 +69,28 @@ RSpec.describe Storages::Adapters::Providers::Sharepoint::StorageWizard dowizard.prepare_next_stepend- it "automatically finished the access_management step" do- expect(wizard.completed_steps).to eq(%i[general_information access_management])+ it "finishes the oauth_client step" do+ expect(wizard.completed_steps).to eq(%i[general_information oauth_client])end- it "disabled automatic storage management, and didn't persist it" do- expect(model).not_to be_automatic_management_enabled- before, after = model.changes["provider_fields"]- expect(before.keys).not_to include("automatically_managed")- expect(after.keys).to include("automatically_managed")+ it "now has an unsaved oauth_client" do+ expect(model.oauth_client).to be_present+ expect(model.oauth_client).not_to be_persistedend- it "has no oauth_client yet" do- expect(model.oauth_client).to be_nil- end-- context "and the next step was prepared" do+ context "when the client was saved" dobefore do- wizard.prepare_next_step- end-- it "finishes the oauth_client step" do- expect(wizard.completed_steps).to eq(%i[general_information access_management oauth_client])+ model.oauth_client.assign_attributes(client_id: "Foo", client_secret: "Bar")+ model.oauth_client.save!end- it "now has an unsaved oauth_client" do- expect(model.oauth_client).to be_present- expect(model.oauth_client).not_to be_persisted+ it "did not finish the final step immediately" do+ expect(wizard.pending_steps).to eq(%i[redirect_uri])end- context "when the client was saved" do- before do- model.oauth_client.assign_attributes(client_id: "Foo", client_secret: "Bar")- model.oauth_client.save!- end-- it "did not finish the final step immediately" do- expect(wizard.pending_steps).to eq(%i[redirect_uri])- end-- it "after some time, the final step is completed" do- Timecop.travel(15.seconds.from_now) do- expect(wizard.completed_steps).to eq(%i[general_information access_management oauth_client redirect_uri])- end+ it "after some time, the final step is completed" do+ Timecop.travel(15.seconds.from_now) do+ expect(wizard.completed_steps).to eq(%i[general_information oauth_client redirect_uri])endendend