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

[chore] reintroduced file info query

Eric Schubert8919c9c41c5b
diff --git a/modules/storages/app/common/storages/peripherals/storage_error_helper.rb b/modules/storages/app/common/storages/peripherals/storage_error_helper.rb
index 541cb4e7bb4..2dfdb342c29 100644
--- a/modules/storages/app/common/storages/peripherals/storage_error_helper.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_error_helper.rb
@@ -42,5 +42,20 @@ module Storages::Peripherals
raise API::Errors::InternalError.new
end
end
+
+ def error_to_code(error)
+ case error.code
+ when :bad_request
+ 400
+ when :not_authorized
+ 401
+ when :forbidden
+ 403
+ when :not_found
+ 404
+ else
+ 500
+ end
+ end
end
end
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud.rb
index 4cb4ebf8ba3..11a4d3c592b 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud.rb
@@ -36,6 +36,7 @@ module Storages
namespace('nextcloud') do
register(:download_link, DownloadLinkQuery)
register(:file_ids, FileIdsQuery)
+ register(:file_info, FileInfoQuery)
register(:files_info, FilesInfoQuery)
register(:files, FilesQuery)
register(:folder_files_file_ids_deep_query, FolderFilesFileIdsDeepQuery)
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_info_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_info_query.rb
new file mode 100644
index 00000000000..58f7850e7b4
--- /dev/null
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_info_query.rb
@@ -0,0 +1,137 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 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::Peripherals::StorageInteraction::Nextcloud
+ class FileInfoQuery
+ using Storages::Peripherals::ServiceResultRefinements
+
+ FILE_INFO_PATH = 'ocs/v1.php/apps/integration_openproject/fileinfo'
+
+ def initialize(storage)
+ @uri = storage.uri
+ @configuration = storage.oauth_configuration
+ end
+
+ def self.call(storage:, user:, file_id:)
+ new(storage).call(user:, file_id:)
+ end
+
+ def call(user:, file_id:)
+ Util.token(user:, configuration: @configuration) do |token|
+ file_info(file_id, token).map(&parse_json) >> handle_failure >> create_storage_file_info
+ end
+ end
+
+ private
+
+ def file_info(file_id, token)
+ response = Util.http(@uri).get(
+ Util.join_uri_path(@uri.path, FILE_INFO_PATH, file_id),
+ {
+ 'Authorization' => "Bearer #{token.access_token}",
+ 'Accept' => 'application/json',
+ 'OCS-APIRequest' => 'true'
+ }
+ )
+
+ case response
+ when Net::HTTPSuccess
+ ServiceResult.success(result: response.body)
+ when Net::HTTPNotFound
+ Util.error(:not_found, 'Outbound request destination not found!', response)
+ when Net::HTTPUnauthorized
+ Util.error(:not_authorized, 'Outbound request not authorized!', response)
+ else
+ Util.error(:error, 'Outbound request failed!')
+ end
+ end
+
+ def parse_json
+ ->(response_body) do
+ # rubocop:disable Style/OpenStructUse
+ JSON.parse(response_body, object_class: OpenStruct)
+ # rubocop:enable Style/OpenStructUse
+ end
+ end
+
+ def handle_failure
+ ->(response_object) do
+ case response_object.ocs.meta.statuscode
+ when 200
+ ServiceResult.success(result: response_object)
+ when 403
+ Util.error(:forbidden, 'Access to storage file forbidden!', response_object)
+ when 404
+ Util.error(:not_found, 'Storage file not found!', response_object)
+ else
+ Util.error(:error, 'Outbound request failed!', response_object)
+ end
+ end
+ end
+
+ # rubocop:disable Metrics/AbcSize
+ def create_storage_file_info
+ ->(response_object) do
+ data = response_object.ocs.data
+ ServiceResult.success(
+ result: ::Storages::StorageFileInfo.new(
+ status: data.status,
+ status_code: data.statuscode,
+ id: data.id,
+ name: data.name,
+ last_modified_at: Time.zone.at(data.mtime),
+ created_at: Time.zone.at(data.ctime),
+ mime_type: data.mimetype,
+ size: data.size,
+ owner_name: data.owner_name,
+ owner_id: data.owner_id,
+ trashed: data.trashed,
+ last_modified_by_name: data.modifier_name,
+ last_modified_by_id: data.modifier_id,
+ permissions: data.dav_permissions,
+ location: location(data.path)
+ )
+ )
+ end
+ end
+
+ # rubocop:enable Metrics/AbcSize
+
+ def location(file_path)
+ prefix = 'files/'
+ idx = file_path.rindex(prefix)
+ return '/' if idx == nil
+
+ idx += prefix.length - 1
+
+ Util.escape_path(file_path[idx..])
+ end
+ end
+end
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive.rb
index 7e7e37fca23..60096478dfd 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive.rb
@@ -35,6 +35,8 @@ module Storages
Queries = Dry::Container::Namespace.new('queries') do
namespace('one_drive') do
register(:files, FilesQuery)
+ register(:file_info, FileInfoQuery)
+ register(:files_info, FilesInfoQuery)
end
end
end
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/file_info_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/file_info_query.rb
new file mode 100644
index 00000000000..42b062e081a
--- /dev/null
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/file_info_query.rb
@@ -0,0 +1,117 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 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 Peripherals
+ module StorageInteraction
+ module OneDrive
+ class FileInfoQuery
+ using ServiceResultRefinements
+
+ def self.call(storage:, user:, file_id:)
+ new(storage).call(user:, file_id:)
+ end
+
+ def initialize(storage)
+ @storage = storage
+ @uri = storage.uri
+ end
+
+ def call(user:, file_id:)
+ Util.using_user_token(@storage, user) do |token|
+ make_file_request(file_id, token).map(&storage_file_infos)
+ end
+ end
+
+ private
+
+ def make_file_request(file_id, token)
+ response_data = Net::HTTP.start(@uri.host, @uri.port, use_ssl: true) do |http|
+ http.get(uri_path_for(file_id), { 'Authorization' => "Bearer #{token.access_token}" })
+ end
+
+ handle_responses(response_data)
+ end
+
+ def handle_responses(response)
+ json = MultiJson.load(response.body, symbolize_keys: true)
+
+ case response
+ when Net::HTTPSuccess
+ ServiceResult.success(result: json)
+ when Net::HTTPNotFound
+ ServiceResult.failure(result: :not_found,
+ errors: ::Storages::StorageError.new(code: :not_found, data: json))
+ when Net::HTTPForbidden
+ ServiceResult.failure(result: :forbidden,
+ errors: ::Storages::StorageError.new(code: :forbidden, data: json))
+ when Net::HTTPUnauthorized
+ ServiceResult.failure(result: :not_authorized,
+ errors: ::Storages::StorageError.new(code: :not_authorized, data: json))
+ else
+ ServiceResult.failure(result: :error,
+ errors: ::Storages::StorageError.new(code: :error, data: json))
+ end
+ end
+
+ def uri_path_for(file_id)
+ "/v1.0/drives/#{@storage.drive_id}/items/#{file_id}"
+ end
+
+ def storage_file_infos
+ ->(json) do
+ StorageFileInfo.new(
+ status: 'ok',
+ status_code: 200,
+ id: json[:id],
+ name: json[:name],
+ last_modified_at: DateTime.parse(json.dig(:fileSystemInfo, :lastModifiedDateTime)),
+ created_at: DateTime.parse(json.dig(:fileSystemInfo, :createdDateTime)),
+ mime_type: Util.mime_type(json),
+ size: json[:size],
+ owner_name: json.dig(:createdBy, :user, :displayName),
+ owner_id: json.dig(:createdBy, :user, :id),
+ trashed: false,
+ last_modified_by_name: json.dig(:lastModifiedBy, :user, :displayName),
+ last_modified_by_id: json.dig(:lastModifiedBy, :user, :id),
+ permissions: nil,
+ location: json.dig(:parentReference, :path)
+ )
+ end
+ end
+
+ def parse_json(str)
+ MultiJson.load(str, symbolize_keys: true)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_info_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_info_query.rb
index 6c13224271b..d7a971a52a2 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_info_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_info_query.rb
@@ -33,6 +33,8 @@ module Storages
module StorageInteraction
module OneDrive
class FilesInfoQuery
+ include StorageErrorHelper
+
using ServiceResultRefinements
def self.call(storage:, user:, file_ids: [])
@@ -45,103 +47,33 @@ module Storages
end
def call(user:, file_ids:)
- using_user_token(user) do |token|
- make_file_requests(file_ids, token).map(&storage_file_infos)
- end
- end
-
- private
-
- def make_file_requests(file_ids, token)
if file_ids.nil?
- return ServiceResult.failure(result: :error, errors: ::Storages::StorageError.new(code: :error))
- end
-
- response_data = Net::HTTP.start(@uri.host, @uri.port, use_ssl: true) do |http|
- file_ids.map do |file_id|
- {
- file_id:,
- response: http.get(uri_path_for(file_id), { 'Authorization' => "Bearer #{token.access_token}" })
- }
- end
- end
-
- handle_responses(response_data)
- end
-
- def handle_responses(response_data)
- if response_data.all? { |data| data[:response].is_a?(Net::HTTPSuccess) || data[:response].is_a?(Net::HTTPNotFound) }
- ServiceResult.success(result: response_data)
- elsif response_data.any? { |data| data[:response].is_a?(Net::HTTPUnauthorized) }
- ServiceResult.failure(result: :not_authorized, errors: ::Storages::StorageError.new(code: :not_authorized))
- else
- ServiceResult.failure(result: :error, errors: ::Storages::StorageError.new(code: :error))
+ return ServiceResult.failure(
+ result: :error,
+ errors: ::Storages::StorageError.new(code: :error, log_message: 'File IDs can not be nil')
+ )
end
- end
-
- def uri_path_for(file_id)
- "/v1.0/drives/#{@storage.drive_id}/items/#{file_id}"
- end
-
- # rubocop:disable Metrics/AbcSize
- def storage_file_infos
- ->(response_data) do
- response_data.map do |data|
- response = data[:response]
- json = MultiJson.load(response.body, symbolize_keys: true)
- if response.is_a?(Net::HTTPSuccess)
- StorageFileInfo.new(
- status: 'ok',
- status_code: response.code,
- id: json[:id],
- name: json[:name],
- last_modified_at: DateTime.parse(json.dig(:fileSystemInfo, :lastModifiedDateTime)),
- created_at: DateTime.parse(json.dig(:fileSystemInfo, :createdDateTime)),
- mime_type: mime_type(json),
- size: json[:size],
- owner_name: json.dig(:createdBy, :user, :displayName),
- owner_id: json.dig(:createdBy, :user, :id),
- trashed: false,
- last_modified_by_name: json.dig(:lastModifiedBy, :user, :displayName),
- last_modified_by_id: json.dig(:lastModifiedBy, :user, :id),
- permissions: nil,
- location: json.dig(:parentReference, :path)
- )
- else
- StorageFileInfo.new(
- status: json.dig(:error, :code),
- status_code: response.code,
- id: data[:file_id]
- )
- end
- end
+ result = file_ids.map do |file_id|
+ wrap_storage_file_error(file_id, FileInfoQuery.call(storage: @storage, user:, file_id:))
end
- end
-
- # rubocop:enable Metrics/AbcSize
- def mime_type(json)
- json.dig(:file, :mimeType) || (json.key?(:folder) ? 'application/x-op-directory' : nil)
+ ServiceResult.success(result:)
end
- def using_user_token(user, &)
- connection_manager = ::OAuthClients::ConnectionManager
- .new(user:, configuration: @storage.oauth_configuration)
+ private
- connection_manager
- .get_access_token
- .match(
- on_success: ->(token) do
- connection_manager.request_with_token_refresh(token) { yield token }
- end,
- on_failure: ->(_) do
- ServiceResult.failure(
- result: :not_authorized,
- message: 'Query could not be created! No access token found!'
- )
- end
+ def wrap_storage_file_error(file_id, query_result)
+ if query_result.success?
+ query_result.result
+ else
+ storage_error = query_result.errors
+ StorageFileInfo.new(
+ id: file_id,
+ status: storage_error.data.dig(:error, :code),
+ status_code: error_to_code(storage_error)
)
+ end
end
end
end
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb
index c19934884fa..9dc79cbc072 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb
@@ -33,9 +33,10 @@ module Storages
module StorageInteraction
module OneDrive
class FilesQuery
- FIELDS = "?$select=id,name,size,webUrl,lastModifiedBy,createdBy,fileSystemInfo,file,folder"
+ FIELDS = "?$select=id,name,size,webUrl,lastModifiedBy,createdBy,fileSystemInfo,file,folder,parentReference"
using ServiceResultRefinements
+
def self.call(storage:, user:, folder:)
new(storage).call(user:, folder:)
end
@@ -46,7 +47,7 @@ module Storages
end
def call(user:, folder: nil)
- result = using_user_token(user) do |token|
+ result = Util.using_user_token(@storage, user) do |token|
# Make the Get Request to the necessary endpoints
response = Net::HTTP.start(@uri.host, @uri.port, use_ssl: true) do |http|
http.get(uri_path_for(folder) + FIELDS, { 'Authorization' => "Bearer #{token.access_token}" })
@@ -74,7 +75,7 @@ module Storages
end
def uri_path_for(folder)
- return "/v1.0/me/drive/root/children" unless folder
+ return "/v1.0/drives/#{@storage.drive_id}/root/children" unless folder
"/v1.0/drives/#{@storage.drive_id}/items/#{folder}/children"
end
@@ -85,39 +86,16 @@ module Storages
id: json[:id],
name: json[:name],
size: json[:size],
- mime_type: mime_type(json),
+ mime_type: Util.mime_type(json),
created_at: DateTime.parse(json.dig(:fileSystemInfo, :createdDateTime)),
last_modified_at: DateTime.parse(json.dig(:fileSystemInfo, :lastModifiedDateTime)),
created_by_name: json.dig(:createdBy, :user, :displayName),
last_modified_by_name: json.dig(:lastModifiedBy, :user, :displayName),
- location: json[:webUrl],
+ location: json.dig(:parentReference, :path),
permissions: nil
)
end
end
-
- def mime_type(json)
- json.dig(:file, :mimeType) || (json.key?(:folder) ? 'application/x-op-directory' : nil)
- end
-
- def using_user_token(user, &block)
- connection_manager = ::OAuthClients::ConnectionManager
- .new(user:, configuration: @storage.oauth_configuration)
-
- connection_manager
- .get_access_token
- .match(
- on_success: ->(token) do
- connection_manager.request_with_token_refresh(token) { block.call(token) }
- end,
- on_failure: ->(_) do
- ServiceResult.failure(
- result: :not_authorized,
- message: 'Query could not be created! No access token found!'
- )
- end
- )
- end
end
end
end
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rb
new file mode 100644
index 00000000000..71b25846131
--- /dev/null
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rb
@@ -0,0 +1,61 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 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::Peripherals::StorageInteraction::OneDrive::Util
+ using Storages::Peripherals::ServiceResultRefinements
+
+ class << self
+ def mime_type(json)
+ json.dig(:file, :mimeType) || (json.key?(:folder) ? 'application/x-op-directory' : nil)
+ end
+
+ def using_user_token(storage, user, &)
+ connection_manager = ::OAuthClients::ConnectionManager
+ .new(user:, configuration: storage.oauth_configuration)
+
+ connection_manager
+ .get_access_token
+ .match(
+ on_success: ->(token) do
+ connection_manager.request_with_token_refresh(token) { yield token }
+ end,
+ on_failure: ->(_) do
+ ServiceResult.failure(
+ result: :not_authorized,
+ errors: ::Storages::StorageError.new(
+ code: :not_authorized,
+ log_message: 'Query could not be created! No access token found!'
+ )
+ )
+ end
+ )
+ end
+ end
+end
diff --git a/modules/storages/lib/api/v3/storage_files/storage_files_api.rb b/modules/storages/lib/api/v3/storage_files/storage_files_api.rb
index ac7990aafbd..fc78d5b590f 100644
--- a/modules/storages/lib/api/v3/storage_files/storage_files_api.rb
+++ b/modules/storages/lib/api/v3/storage_files/storage_files_api.rb
@@ -35,11 +35,13 @@ module API::V3::StorageFiles
resources :files do
get do
- Storages::Peripherals::Registry.resolve("queries.#{@storage.short_provider_type}.files")
+ Storages::Peripherals::Registry
+ .resolve("queries.#{@storage.short_provider_type}.files")
.call(
storage: @storage,
user: current_user, folder: params[:parent]
- ).match(
+ )
+ .match(
on_success: ->(files) { API::V3::StorageFiles::StorageFilesRepresenter.new(files, @storage, current_user:) },
on_failure: ->(error) { raise_error(error) }
)
@@ -47,24 +49,16 @@ module API::V3::StorageFiles
route_param :file_id, type: String, desc: 'Storage file id' do
get do
- service_result = Storages::Peripherals::Registry.resolve("queries.#{@storage.short_provider_type}.files_info")
- .call(
- storage: @storage,
- user: current_user, file_ids: [params[:file_id]]
- ).map(&:first)
-
- if service_result.success? && service_result.result.status_code == 403
- storage_error = Storages::StorageError.new(code: :forbidden, log_message: 'no access to file', data: nil)
- service_result = ServiceResult.failure(result: :forbidden, errors: storage_error)
- end
-
- service_result.map { |file_info| to_storage_file(file_info) }
- .match(
- on_success: ->(storage_file) {
- API::V3::StorageFiles::StorageFileRepresenter.new(storage_file, @storage, current_user:)
- },
- on_failure: ->(error) { raise_error(error) }
- )
+ Storages::Peripherals::Registry
+ .resolve("queries.#{@storage.short_provider_type}.file_info")
+ .call(storage: @storage, user: current_user, file_id: params[:file_id])
+ .map { |file_info| to_storage_file(file_info) }
+ .match(
+ on_success: ->(storage_file) {
+ API::V3::StorageFiles::StorageFileRepresenter.new(storage_file, @storage, current_user:)
+ },
+ on_failure: ->(error) { raise_error(error) }
+ )
end
end
@@ -80,11 +74,10 @@ module API::V3::StorageFiles
end
validate.call(request_body) >> ->(data) do
- Storages::Peripherals::Registry.resolve("queries.#{@storage.short_provider_type}.upload_link")
- .call(
- storage: @storage,
- user: current_user, data:
- ).match(
+ Storages::Peripherals::Registry
+ .resolve("queries.#{@storage.short_provider_type}.upload_link")
+ .call(storage: @storage, user: current_user, data:)
+ .match(
on_success: ->(link) { API::V3::StorageFiles::StorageUploadLinkRepresenter.new(link, current_user:) },
on_failure: ->(error) { raise_error(error) }
)
diff --git a/modules/storages/spec/common/peripherals/registry_spec.rb b/modules/storages/spec/common/storages/peripherals/registry_spec.rb
similarity index 99%
rename from modules/storages/spec/common/peripherals/registry_spec.rb
rename to modules/storages/spec/common/storages/peripherals/registry_spec.rb
index 938cb6cbd4f..ccbd089d6d1 100644
--- a/modules/storages/spec/common/peripherals/registry_spec.rb
+++ b/modules/storages/spec/common/storages/peripherals/registry_spec.rb
@@ -31,7 +31,7 @@
require 'spec_helper'
require_module_spec_helper
-RSpec.describe Storages::Peripherals::Registry, webmock: true do
+RSpec.describe Storages::Peripherals::Registry, :webmock do
using Storages::Peripherals::ServiceResultRefinements
let(:user) { create(:user) }
diff --git a/modules/storages/spec/common/peripherals/copy_template_folder_command_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/copy_template_folder_command_spec.rb
similarity index 98%
rename from modules/storages/spec/common/peripherals/copy_template_folder_command_spec.rb
rename to modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/copy_template_folder_command_spec.rb
index 18e775ab240..2ab785810b1 100644
--- a/modules/storages/spec/common/peripherals/copy_template_folder_command_spec.rb
+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/copy_template_folder_command_spec.rb
@@ -31,7 +31,7 @@
require 'spec_helper'
require_module_spec_helper
-RSpec.describe Storages::Peripherals::StorageInteraction::Nextcloud::CopyTemplateFolderCommand, webmock: true do
+RSpec.describe Storages::Peripherals::StorageInteraction::Nextcloud::CopyTemplateFolderCommand, :webmock do
using Storages::Peripherals::ServiceResultRefinements
let(:user) { create(:user) }
diff --git a/modules/storages/spec/common/peripherals/files_info_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/files_info_query_spec.rb
similarity index 98%
rename from modules/storages/spec/common/peripherals/files_info_query_spec.rb
rename to modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/files_info_query_spec.rb
index d549bac822d..78beffc58b6 100644
--- a/modules/storages/spec/common/peripherals/files_info_query_spec.rb
+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/files_info_query_spec.rb
@@ -31,8 +31,7 @@
require 'spec_helper'
require_module_spec_helper
-RSpec.describe Storages::Peripherals::StorageInteraction::Nextcloud::FilesInfoQuery,
- :vcr, webmock: true do
+RSpec.describe Storages::Peripherals::StorageInteraction::Nextcloud::FilesInfoQuery, :vcr, :webmock do
using Storages::Peripherals::ServiceResultRefinements
let(:user) { create(:user) }
diff --git a/modules/storages/spec/common/peripherals/util_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/util_spec.rb
similarity index 100%
rename from modules/storages/spec/common/peripherals/util_spec.rb
rename to modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/util_spec.rb
diff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/file_info_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/file_info_query_spec.rb
new file mode 100644
index 00000000000..e5ccdf84043
--- /dev/null
+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/file_info_query_spec.rb
@@ -0,0 +1,110 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 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
+
+RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FileInfoQuery, :webmock do
+ include JsonResponseHelper
+
+ let(:storage) do
+ create(:one_drive_storage,
+ :with_oauth_client,
+ drive_id: 'b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd')
+ end
+ let(:user) { create(:user) }
+ let(:token) { create(:oauth_client_token, user:, oauth_client: storage.oauth_client) }
+ let(:file_id) { '01BYE5RZ5MYLM2SMX75ZBIPQZIHT6OAYPB' }
+ let(:not_found_json) { not_found_response }
+ let(:forbidden_json) { forbidden_response }
+
+ before do
+ stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/items/#{file_id}")
+ .with(headers: { 'Authorization' => "Bearer #{token.access_token}" })
+ .to_return(status: 200, body: read_json('folder_drive_item'), headers: {})
+ end
+
+ 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 user], %i[keyreq file_id])
+ end
+
+ it 'returns a storage file info object' do
+ storage_file_info = described_class.call(storage:, user:, file_id:).result
+
+ # rubocop:disable Layout/LineLength
+ expect(storage_file_info.to_h).to eq({
+ status: 'ok',
+ status_code: 200,
+ id: '01BYE5RZ5MYLM2SMX75ZBIPQZIHT6OAYPB',
+ name: 'Business Data',
+ size: 39566226,
+ mime_type: 'application/x-op-directory',
+ created_at: Time.parse('2017-08-07T16:16:30Z'),
+ last_modified_at: Time.parse('2017-08-07T16:16:30Z'),
+ owner_name: 'Megan Bowen',
+ owner_id: '48d31887-5fad-4d73-a9f5-3c356e68a038',
+ last_modified_by_id: '48d31887-5fad-4d73-a9f5-3c356e68a038',
+ last_modified_by_name: 'Megan Bowen',
+ permissions: nil,
+ trashed: false,
+ location: '/drives/b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd/root:'
+ })
+ # rubocop:enable Layout/LineLength
+ end
+
+ describe 'error handling' do
+ it 'returns a notfound error if the API call returns a 404' do
+ stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/items/#{file_id}")
+ .with(headers: { 'Authorization' => "Bearer #{token.access_token}" })
+ .to_return(status: 404, body: not_found_json, headers: {})
+
+ storage_files = described_class.call(storage:, user:, file_id:)
+
+ expect(storage_files).to be_failure
+ expect(storage_files.result).to eq(:not_found)
+ expect(storage_files.errors.data.to_json).to eq(not_found_json)
+ end
+
+ it 'returns a forbidden error if the API call returns a 403' do
+ stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/items/#{file_id}")
+ .with(headers: { 'Authorization' => "Bearer #{token.access_token}" })
+ .to_return(status: 403, body: forbidden_json, headers: {})
+
+ storage_files = described_class.call(storage:, user:, file_id:)
+
+ expect(storage_files).to be_failure
+ expect(storage_files.result).to eq(:forbidden)
+ expect(storage_files.errors.data.to_json).to eq(forbidden_json)
+ end
+ end
+end
diff --git a/modules/storages/spec/common/peripherals/storage_interaction/one_drive/files_info_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_info_query_spec.rb
similarity index 80%
rename from modules/storages/spec/common/peripherals/storage_interaction/one_drive/files_info_query_spec.rb
rename to modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_info_query_spec.rb
index 4a1ac7a4458..c2b96136c65 100644
--- a/modules/storages/spec/common/peripherals/storage_interaction/one_drive/files_info_query_spec.rb
+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_info_query_spec.rb
@@ -31,7 +31,7 @@
require 'spec_helper'
require_module_spec_helper
-RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesInfoQuery, webmock: true do
+RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesInfoQuery, :webmock do
include JsonResponseHelper
let(:storage) do
@@ -47,21 +47,11 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesInfoQue
01BYE5RZZ6FUE5272C5JCY3L7CLZ7XOUYM
01BYE5RZ47DTJGHO73WBH2ONNXQZVNNILJ
not_existent
+ forbidden
)
end
- let(:not_found_json) do
- {
- error: {
- code: 'itemNotFound',
- message: 'The resource could not be found.',
- innerError: {
- date: '2023-09-08T08:20:55',
- 'request-id': '286b0215-7f33-46dc-b1fe-67720fe1616a',
- 'client-request-id': '286b0215-7f33-46dc-b1fe-67720fe1616a'
- }
- }
- }.to_json
- end
+ let(:not_found_json) { not_found_response }
+ let(:forbidden_json) { forbidden_response }
before do
stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/items/#{file_ids[0]}")
@@ -76,6 +66,9 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesInfoQue
stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/items/#{file_ids[3]}")
.with(headers: { 'Authorization' => "Bearer #{token.access_token}" })
.to_return(status: 404, body: not_found_json, headers: {})
+ stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/items/#{file_ids[4]}")
+ .with(headers: { 'Authorization' => "Bearer #{token.access_token}" })
+ .to_return(status: 403, body: forbidden_json, headers: {})
end
it 'responds to .call' do
@@ -97,7 +90,7 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesInfoQue
# rubocop:disable Layout/LineLength
expect(storage_file_info.to_h).to eq({
status: 'ok',
- status_code: '200',
+ status_code: 200,
id: '01BYE5RZ5MYLM2SMX75ZBIPQZIHT6OAYPB',
name: 'Business Data',
size: 39566226,
@@ -121,7 +114,7 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesInfoQue
# rubocop:disable Layout/LineLength
expect(storage_file_info.to_h).to eq({
status: 'ok',
- status_code: '200',
+ status_code: 200,
id: '01BYE5RZZ6FUE5272C5JCY3L7CLZ7XOUYM',
name: 'All Japan Revenues By City.xlsx',
size: 20051,
@@ -139,12 +132,12 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesInfoQue
# rubocop:enable Layout/LineLength
end
- it 'returns an error storage file info object' do
+ it 'returns an error storage file info object for not found' do
storage_file_info = described_class.call(storage:, user:, file_ids: file_ids.slice(3, 1)).result[0]
expect(storage_file_info.to_h).to eq({
status: 'itemNotFound',
- status_code: '404',
+ status_code: 404,
id: 'not_existent',
name: nil,
size: nil,
@@ -161,6 +154,28 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesInfoQue
})
end
+ it 'returns an error storage file info object for forbidden' do
+ storage_file_info = described_class.call(storage:, user:, file_ids: file_ids.slice(4, 1)).result[0]
+
+ expect(storage_file_info.to_h).to eq({
+ status: 'accessDenied',
+ status_code: 403,
+ id: 'forbidden',
+ name: nil,
+ size: nil,
+ mime_type: nil,
+ created_at: nil,
+ last_modified_at: nil,
+ owner_name: nil,
+ owner_id: nil,
+ last_modified_by_id: nil,
+ last_modified_by_name: nil,
+ permissions: nil,
+ trashed: nil,
+ location: nil
+ })
+ end
+
describe 'error handling' do
it 'returns a success with empty result, if the query is called with empty file ids array' do
storage_files = described_class.call(storage:, user:, file_ids: [])
@@ -174,19 +189,7 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesInfoQue
expect(storage_files).to be_failure
expect(storage_files.result).to eq(:error)
- expect(storage_files.errors.to_s).to eq(Storages::StorageError.new(code: :error).to_s)
- end
-
- it 'returns a :not_authorized error if any API call returns a 401' do
- stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/items/#{file_ids[0]}")
- .with(headers: { 'Authorization' => "Bearer #{token.access_token}" })
- .to_return(status: 401, body: '', headers: {})
-
- storage_files = described_class.call(storage:, user:, file_ids: file_ids.slice(0, 1))
-
- expect(storage_files).to be_failure
- expect(storage_files.result).to eq(:not_authorized)
- expect(storage_files.errors.to_s).to eq(Storages::StorageError.new(code: :not_authorized).to_s)
+ expect(storage_files.errors.to_s).to eq('error | File IDs can not be nil')
end
end
end
diff --git a/modules/storages/spec/common/peripherals/storage_interaction/one_drive/files_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_query_spec.rb
similarity index 70%
rename from modules/storages/spec/common/peripherals/storage_interaction/one_drive/files_query_spec.rb
rename to modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_query_spec.rb
index 45c79c51423..88623d72fb0 100644
--- a/modules/storages/spec/common/peripherals/storage_interaction/one_drive/files_query_spec.rb
+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_query_spec.rb
@@ -31,10 +31,14 @@
require 'spec_helper'
require_module_spec_helper
-RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesQuery, webmock: true do
+RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesQuery, :webmock do
include JsonResponseHelper
- let(:storage) { create(:one_drive_storage, :with_oauth_client) }
+ let(:storage) do
+ create(:one_drive_storage,
+ :with_oauth_client,
+ drive_id: 'b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd')
+ end
let(:user) { create(:user) }
let(:json) { read_json('root_drive') }
let(:token) { create(:oauth_client_token, user:, oauth_client: storage.oauth_client) }
@@ -47,7 +51,7 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesQuery,
end
it 'returns an array of StorageFile' do
- stub_request(:get, "https://graph.microsoft.com/v1.0/me/drive/root/children?$select=id,name,size,webUrl,lastModifiedBy,createdBy,fileSystemInfo,file,folder")
+ stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/root/children?$select=id,name,size,webUrl,lastModifiedBy,createdBy,fileSystemInfo,file,folder,parentReference")
.with(headers: { 'Authorization' => "Bearer #{token.access_token}" })
.to_return(status: 200, body: json, headers: {})
@@ -56,22 +60,20 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesQuery,
expect(storage_files).to all(be_a(Storages::StorageFile))
one_file = storage_files[10]
- expect(one_file.to_h).to eq(
- { id: '01BYE5RZZ6FUE5272C5JCY3L7CLZ7XOUYM',
- name: "All Japan Revenues By City.xlsx",
- size: 20051,
- mime_type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
- created_at: Time.parse("2017-08-07T16:07:10Z"),
- last_modified_at: Time.parse("2017-08-07T16:07:10Z"),
- created_by_name: "Megan Bowen",
- last_modified_by_name: "Megan Bowen",
- location: "https://m365x214355-my.sharepoint.com/personal/meganb_m365x214355_onmicrosoft_com/_layouts/15/Doc.aspx?sourcedoc=%7BDD092D3E-427F-45EA-8DAF-E25E7F77530C%7D&file=All%20Japan%20Revenues%20By%20City.xlsx&action=default&mobileredirect=true",
- permissions: nil }
- )
+ expect(one_file.to_h).to eq({ id: '01BYE5RZZ6FUE5272C5JCY3L7CLZ7XOUYM',
+ name: "All Japan Revenues By City.xlsx",
+ size: 20051,
+ mime_type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
+ created_at: Time.parse("2017-08-07T16:07:10Z"),
+ last_modified_at: Time.parse("2017-08-07T16:07:10Z"),
+ created_by_name: "Megan Bowen",
+ last_modified_by_name: "Megan Bowen",
+ location: "/drive/root:",
+ permissions: nil })
end
it 'when the argument folder is nil, gets information from that users root folder' do
- stub_request(:get, "https://graph.microsoft.com/v1.0/me/drive/root/children?$select=id,name,size,webUrl,lastModifiedBy,createdBy,fileSystemInfo,file,folder")
+ stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/root/children?$select=id,name,size,webUrl,lastModifiedBy,createdBy,fileSystemInfo,file,folder,parentReference")
.with(headers: { 'Authorization' => "Bearer #{token.access_token}" })
.to_return(status: 200, body: json, headers: {})
@@ -81,15 +83,10 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesQuery,
end
context 'when accessing a specific folder' do
- let(:storage) do
- create(:one_drive_storage,
- :with_oauth_client,
- drive_id: 'b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd')
- end
let(:json) { read_json('specific_folder') }
it 'uses the specific drive url' do
- uri = "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/items/01BYE5RZYJ43UXGBP23BBIFPISHHMCDTOY/children?$select=id,name,size,webUrl,lastModifiedBy,createdBy,fileSystemInfo,file,folder"
+ uri = "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/items/01BYE5RZYJ43UXGBP23BBIFPISHHMCDTOY/children?$select=id,name,size,webUrl,lastModifiedBy,createdBy,fileSystemInfo,file,folder,parentReference"
stub_request(:get, uri)
.with(headers: { 'Authorization' => "Bearer #{token.access_token}" })
.to_return(status: 200, body: json, headers: {})
@@ -102,7 +99,7 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesQuery,
describe 'error handling' do
it 'returns a notfound error if the API call returns a 404' do
- stub_request(:get, "https://graph.microsoft.com/v1.0/me/drive/root/children?$select=id,name,size,webUrl,lastModifiedBy,createdBy,fileSystemInfo,file,folder")
+ stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/root/children?$select=id,name,size,webUrl,lastModifiedBy,createdBy,fileSystemInfo,file,folder,parentReference")
.with(headers: { 'Authorization' => "Bearer #{token.access_token}" })
.to_return(status: 404, body: '', headers: {})
@@ -114,7 +111,7 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesQuery,
end
it 'retries authentication when it returns a 401' do
- stub_request(:get, "https://graph.microsoft.com/v1.0/me/drive/root/children?$select=id,name,size,webUrl,lastModifiedBy,createdBy,fileSystemInfo,file,folder")
+ stub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/root/children?$select=id,name,size,webUrl,lastModifiedBy,createdBy,fileSystemInfo,file,folder,parentReference")
.with(headers: { 'Authorization' => "Bearer #{token.access_token}" })
.to_return(status: 401, body: '', headers: {})
diff --git a/modules/storages/spec/requests/api/v3/storages/storage_files_api_spec.rb b/modules/storages/spec/requests/api/v3/storages/storage_files_api_spec.rb
index 4cbdf2aae0c..5e019ef4b54 100644
--- a/modules/storages/spec/requests/api/v3/storages/storage_files_api_spec.rb
+++ b/modules/storages/spec/requests/api/v3/storages/storage_files_api_spec.rb
@@ -31,7 +31,7 @@
require 'spec_helper'
require_module_spec_helper
-RSpec.describe 'API v3 storage files', content_type: :json, webmock: true do
+RSpec.describe 'API v3 storage files', :webmock, content_type: :json do
include API::V3::Utilities::PathHelper
include StorageServerHelpers
@@ -170,70 +170,48 @@ RSpec.describe 'API v3 storage files', content_type: :json, webmock: true do
context 'with successful response' do
let(:response) do
- [
- Storages::StorageFileInfo.new(
- status: 'OK',
- status_code: 200,
- id: file_id,
- name: "Documents",
- last_modified_at: DateTime.now,
- created_at: DateTime.now,
- mime_type: 'application/x-op-directory',
- size: 1108864,
- owner_name: 'Darth Vader',
- owner_id: 'darthvader',
- trashed: false,
- last_modified_by_name: 'Darth Sidious',
- last_modified_by_id: 'palpatine',
- permissions: 'RGDNVCK',
- location: '/Documents'
- )
- ]
+ Storages::StorageFileInfo.new(
+ status: 'OK',
+ status_code: 200,
+ id: file_id,
+ name: "Documents",
+ last_modified_at: DateTime.now,
+ created_at: DateTime.now,
+ mime_type: 'application/x-op-directory',
+ size: 1108864,
+ owner_name: 'Darth Vader',
+ owner_id: 'darthvader',
+ trashed: false,
+ last_modified_by_name: 'Darth Sidious',
+ last_modified_by_id: 'palpatine',
+ permissions: 'RGDNVCK',
+ location: '/Documents'
+ )
end
before do
files_info_query = ->(_) { ServiceResult.success(result: response) }
- Storages::Peripherals::Registry.stub('queries.nextcloud.files_info', files_info_query)
+ Storages::Peripherals::Registry.stub('queries.nextcloud.file_info', files_info_query)
end
subject { last_response.body }
it 'responds with appropriate JSON' do
expect(subject).to be_json_eql('StorageFile'.to_json).at_path('_type')
- expect(subject).to be_json_eql(response[0].id.to_json).at_path('id')
- expect(subject).to be_json_eql(response[0].name.to_json).at_path('name')
- expect(subject).to be_json_eql(response[0].size.to_json).at_path('size')
- expect(subject).to be_json_eql(response[0].mime_type.to_json).at_path('mimeType')
- expect(subject).to be_json_eql(response[0].owner_name.to_json).at_path('createdByName')
- expect(subject).to be_json_eql(response[0].last_modified_by_name.to_json).at_path('lastModifiedByName')
- expect(subject).to be_json_eql(response[0].location.to_json).at_path('location')
- expect(subject).to be_json_eql(response[0].permissions.to_json).at_path('permissions')
- end
-
- context 'and storage file access is forbidden' do
- let(:response) do
- [
- Storages::StorageFileInfo.new(
- id: file_id,
- status: 'Forbidden',
- status_code: 403
- )
- ]
- end
-
- it 'fails with outbound request failure' do
- expect(last_response.status).to be(500)
-
- body = JSON.parse(last_response.body)
- expect(body['message']).to eq(I18n.t('api_v3.errors.code_500_outbound_request_failure', status_code: 403))
- expect(body['errorIdentifier']).to eq('urn:openproject-org:api:v3:errors:OutboundRequest:Forbidden')
- end
+ expect(subject).to be_json_eql(response.id.to_json).at_path('id')
+ expect(subject).to be_json_eql(response.name.to_json).at_path('name')
+ expect(subject).to be_json_eql(response.size.to_json).at_path('size')
+ expect(subject).to be_json_eql(response.mime_type.to_json).at_path('mimeType')
+ expect(subject).to be_json_eql(response.owner_name.to_json).at_path('createdByName')
+ expect(subject).to be_json_eql(response.last_modified_by_name.to_json).at_path('lastModifiedByName')
+ expect(subject).to be_json_eql(response.location.to_json).at_path('location')
+ expect(subject).to be_json_eql(response.permissions.to_json).at_path('permissions')
end
end
context 'with query failed' do
before do
- clazz = Storages::Peripherals::StorageInteraction::Nextcloud::FilesInfoQuery
+ clazz = Storages::Peripherals::StorageInteraction::Nextcloud::FileInfoQuery
instance = instance_double(clazz)
allow(clazz).to receive(:new).and_return(instance)
allow(instance).to receive(:call).and_return(
diff --git a/modules/storages/spec/support/json_response_helper.rb b/modules/storages/spec/support/json_response_helper.rb
index 17e327f6b5b..a9a4d3e7e18 100644
--- a/modules/storages/spec/support/json_response_helper.rb
+++ b/modules/storages/spec/support/json_response_helper.rb
@@ -38,4 +38,32 @@ module JsonResponseHelper
def payload_path
Pathname.new(Rails.root).join('modules/storages/spec/support/payloads/')
end
+
+ def not_found_response
+ {
+ error: {
+ code: 'itemNotFound',
+ message: 'The resource could not be found.',
+ innerError: {
+ date: '2023-09-08T08:20:55',
+ 'request-id': '286b0215-7f33-46dc-b1fe-67720fe1616a',
+ 'client-request-id': '286b0215-7f33-46dc-b1fe-67720fe1616a'
+ }
+ }
+ }.to_json
+ end
+
+ def forbidden_response
+ {
+ error: {
+ code: 'accessDenied',
+ message: 'Access denied',
+ innerError: {
+ date: '2023-09-08T08:20:55',
+ 'request-id': '286b0215-7f33-46dc-b1fe-67720fe1616f',
+ 'client-request-id': '286b0215-7f33-46dc-b1fe-67720fe1616b'
+ }
+ }
+ }.to_json
+ end
end
diff --git a/modules/storages/spec/support/payloads/root_drive.json b/modules/storages/spec/support/payloads/root_drive.json
index 6d8ec8e8f46..cda1664a382 100644
--- a/modules/storages/spec/support/payloads/root_drive.json
+++ b/modules/storages/spec/support/payloads/root_drive.json
@@ -1,5 +1,5 @@
{
- "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('48d31887-5fad-4d73-a9f5-3c356e68a038')/drive/root/children(id,name,size,webUrl,lastModifiedBy,createdBy,fileSystemInfo,file,folder)",
+ "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('48d31887-5fad-4d73-a9f5-3c356e68a038')/drive/root/children(id,name,size,webUrl,lastModifiedBy,createdBy,fileSystemInfo,file,folder,parentReference)",
"value": [
{
"@odata.etag": "\"{60F36ED0-85CE-4771-B349-E671C691EFCA},1\"",
@@ -21,6 +21,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"fileSystemInfo": {
"createdDateTime": "2017-07-31T18:56:29Z",
"lastModifiedDateTime": "2017-07-31T18:56:29Z"
@@ -49,6 +56,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"fileSystemInfo": {
"createdDateTime": "2017-08-07T16:16:30Z",
"lastModifiedDateTime": "2017-08-07T16:16:30Z"
@@ -77,6 +91,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"fileSystemInfo": {
"createdDateTime": "2017-08-07T16:10:22Z",
"lastModifiedDateTime": "2017-08-07T16:10:22Z"
@@ -105,6 +126,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"fileSystemInfo": {
"createdDateTime": "2017-08-07T16:18:24Z",
"lastModifiedDateTime": "2017-08-07T16:18:24Z"
@@ -133,6 +161,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"fileSystemInfo": {
"createdDateTime": "2017-08-07T16:05:29Z",
"lastModifiedDateTime": "2017-08-07T16:05:29Z"
@@ -161,6 +196,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"fileSystemInfo": {
"createdDateTime": "2017-08-07T16:17:40Z",
"lastModifiedDateTime": "2017-08-07T16:17:40Z"
@@ -197,6 +239,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"fileSystemInfo": {
"createdDateTime": "2017-09-15T01:15:43Z",
"lastModifiedDateTime": "2017-09-15T01:15:43Z"
@@ -225,6 +274,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"fileSystemInfo": {
"createdDateTime": "2017-08-07T16:13:50Z",
"lastModifiedDateTime": "2017-08-07T16:13:50Z"
@@ -253,6 +309,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"fileSystemInfo": {
"createdDateTime": "2017-08-07T16:06:56Z",
"lastModifiedDateTime": "2017-08-07T16:06:56Z"
@@ -289,6 +352,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"fileSystemInfo": {
"createdDateTime": "2018-03-27T07:34:38Z",
"lastModifiedDateTime": "2018-03-27T07:34:38Z"
@@ -317,6 +387,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"hashes": {
@@ -348,6 +425,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"hashes": {
@@ -379,6 +463,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"hashes": {
@@ -410,6 +501,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "image/jpeg",
"hashes": {
@@ -441,6 +539,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/pdf",
"hashes": {
@@ -472,6 +577,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"hashes": {
@@ -503,6 +615,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"hashes": {
@@ -534,6 +653,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"hashes": {
@@ -565,6 +691,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"hashes": {
@@ -596,6 +729,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"hashes": {
@@ -627,6 +767,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"hashes": {
@@ -658,6 +805,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"hashes": {
@@ -689,6 +843,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"hashes": {
@@ -720,6 +881,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"hashes": {
@@ -751,6 +919,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"hashes": {
@@ -782,6 +957,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"hashes": {
@@ -813,6 +995,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"hashes": {
@@ -844,6 +1033,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
"hashes": {
@@ -873,6 +1069,13 @@
"displayName": "System Account"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/msonenote",
"hashes": {
@@ -904,6 +1107,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"hashes": {
@@ -935,6 +1145,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"hashes": {
@@ -966,6 +1183,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
"hashes": {
@@ -997,6 +1221,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"hashes": {
@@ -1028,6 +1259,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
"hashes": {
@@ -1059,6 +1297,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"hashes": {
@@ -1090,6 +1335,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"hashes": {
@@ -1121,6 +1373,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"hashes": {
@@ -1152,6 +1411,13 @@
"displayName": "Megan Bowen"
}
},
+ "parentReference": {
+ "driveType": "business",
+ "driveId": "b!-RIj2DuyvEyV1T4NlOaMHk8XkS_I8MdFlUCq1BlcjgmhRfAj3-Z8RY2VpuvV_tpd",
+ "id": "01BYE5RZ56Y2GOVW7725BZO354PWSELRRZ",
+ "path": "/drive/root:",
+ "siteId": "d82312f9-b23b-4cbc-95d5-3e0d94e68c1e"
+ },
"file": {
"mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"hashes": {