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
Implement the OpenStorageQuery for Sharepoint
Marcello Rochaeafd7150c9ac
diff --git a/modules/storages/app/common/storages/adapters/providers/share_point/queries/file_info_query.rb b/modules/storages/app/common/storages/adapters/providers/share_point/queries/file_info_query.rbindex 7808fca5022..b56f947b9eb 100644--- a/modules/storages/app/common/storages/adapters/providers/share_point/queries/file_info_query.rb+++ b/modules/storages/app/common/storages/adapters/providers/share_point/queries/file_info_query.rb@@ -23,7 +23,7 @@## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.## See COPYRIGHT and LICENSE files for more details.#++diff --git a/modules/storages/app/common/storages/adapters/providers/share_point/queries/files_info_query.rb b/modules/storages/app/common/storages/adapters/providers/share_point/queries/files_info_query.rbindex c8faa4be37d..7fea570acf0 100644--- a/modules/storages/app/common/storages/adapters/providers/share_point/queries/files_info_query.rb+++ b/modules/storages/app/common/storages/adapters/providers/share_point/queries/files_info_query.rb@@ -23,7 +23,7 @@## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.## See COPYRIGHT and LICENSE files for more details.#++diff --git a/modules/storages/app/common/storages/adapters/providers/share_point/queries/internal/drive_item_query.rb b/modules/storages/app/common/storages/adapters/providers/share_point/queries/internal/drive_item_query.rbindex 40d18fb0afb..3151062e7a7 100644--- a/modules/storages/app/common/storages/adapters/providers/share_point/queries/internal/drive_item_query.rb+++ b/modules/storages/app/common/storages/adapters/providers/share_point/queries/internal/drive_item_query.rb@@ -23,7 +23,7 @@## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.## See COPYRIGHT and LICENSE files for more details.#++diff --git a/modules/storages/app/common/storages/adapters/providers/share_point/queries/open_storage_query.rb b/modules/storages/app/common/storages/adapters/providers/share_point/queries/open_storage_query.rbnew file mode 100644index 00000000000..a01b55f39cd--- /dev/null+++ b/modules/storages/app/common/storages/adapters/providers/share_point/queries/open_storage_query.rb@@ -0,0 +1,45 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module Storages+ module Adapters+ module Providers+ module SharePoint+ module Queries+ class OpenStorageQuery < Base+ def call(**)+ Success(UrlBuilder.url(URI(@storage.host)))+ end+ end+ end+ end+ end+ end+enddiff --git a/modules/storages/app/common/storages/adapters/providers/share_point/share_point_registry.rb b/modules/storages/app/common/storages/adapters/providers/share_point/share_point_registry.rbindex 3805faeea01..2b93b07aaf6 100644--- a/modules/storages/app/common/storages/adapters/providers/share_point/share_point_registry.rb+++ b/modules/storages/app/common/storages/adapters/providers/share_point/share_point_registry.rb@@ -72,6 +72,7 @@ module Storagesregister(:download_link, Queries::DownloadLinkQuery)register(:file_info, Queries::FileInfoQuery)register(:files, Queries::FilesQuery)+ register(:open_storage, Queries::OpenStorageQuery)register(:upload_link, Queries::UploadLinkQuery)register(:user, OneDrive::Queries::UserQuery)enddiff --git a/modules/storages/app/common/storages/adapters/providers/share_point/storage_file_transformer.rb b/modules/storages/app/common/storages/adapters/providers/share_point/storage_file_transformer.rbindex fd34105d797..9fa48c30c5b 100644--- a/modules/storages/app/common/storages/adapters/providers/share_point/storage_file_transformer.rb+++ b/modules/storages/app/common/storages/adapters/providers/share_point/storage_file_transformer.rb@@ -23,7 +23,7 @@## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.## See COPYRIGHT and LICENSE files for more details.#++diff --git a/modules/storages/spec/common/storages/adapters/providers/share_point/queries/open_storage_query_spec.rb b/modules/storages/spec/common/storages/adapters/providers/share_point/queries/open_storage_query_spec.rbnew file mode 100644index 00000000000..054dd264c28--- /dev/null+++ b/modules/storages/spec/common/storages/adapters/providers/share_point/queries/open_storage_query_spec.rb@@ -0,0 +1,58 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++require "spec_helper"+require_module_spec_helper++module Storages+ module Adapters+ module Providers+ module SharePoint+ module Queries+ RSpec.describe OpenStorageQuery do+ let(:storage) { create(:share_point_storage, :sandbox) }++ it "responds to .call" do+ expect(described_class).to respond_to(:call)++ method = described_class.method(:call)+ expect(method.parameters).to contain_exactly(%i[keyreq storage], %i[keyreq auth_strategy], %i[keyreq input_data])+ end++ it "returns the url for opening the file on storage" do+ url = described_class.call(storage:, auth_strategy: nil, input_data: nil).value!+ expect(url).to eq("https://ymt6d.sharepoint.com/sites/OPTest/")+ end+ end+ end+ end+ end+ end+end