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

MInor bugfixes on Sharepoint Storage (#20030)

Marcello Rocha01c22cdd7e40
diff --git a/config/static_links.yml b/config/static_links.yml
index 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-troubleshooting
diff --git a/modules/storages/app/common/storages/adapters/providers/sharepoint/storage_wizard.rb b/modules/storages/app/common/storages/adapters/providers/sharepoint/storage_wizard.rb
index 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 Storages
class StorageWizard < Wizard
step :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 Storages
private
- 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:).call
storage.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
- end
end
end
end
diff --git a/modules/storages/app/helpers/storages/open_storage_links.rb b/modules/storages/app/helpers/storages/open_storage_links.rb
index 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 Storages
case storage
when NextcloudStorage
api_static_link
- when OneDriveStorage
+ when OneDriveStorage, SharepointStorage
raise Errors::ConfigurationError, "No OAuth credential information configured." if storage.oauth_client.nil?
oauth_clients_ensure_connection_url(
@@ -56,7 +56,7 @@ module Storages
case storage
when NextcloudStorage
true
- when OneDriveStorage
+ when OneDriveStorage, SharepointStorage
storage.oauth_client&.persisted?
else
false
diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.yml
index 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 OAuth
project_folders: Project folders
redirect_uri: Redirect URI
+ sharepoint_oauth: Azure OAuth
storage_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 exists
drive_id_format: Drive ID format
header: Configuration
+ host: Host URL
host_url_accessible: Host URL accessible
storage_configured: Configuration complete
tenant_id: Tenant ID
diff --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.rb
index 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 do
it "has all steps pending in correct order" do
expect(wizard.pending_steps).to eq(%i[general_information
- access_management
oauth_client
redirect_uri])
end
@@ -70,49 +69,28 @@ RSpec.describe Storages::Adapters::Providers::Sharepoint::StorageWizard do
wizard.prepare_next_step
end
- 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_persisted
end
- 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" do
before 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])
end
end
end