Skip to content

Commit

Permalink
Merge branch 'dev' into bug/58018-nextcloud-connection-validation-fai…
Browse files Browse the repository at this point in the history
…ls-on-disabled-ampf-configuration
  • Loading branch information
Kharonus committed Sep 25, 2024
2 parents aff09c1 + 34805e1 commit 9613fe4
Show file tree
Hide file tree
Showing 63 changed files with 318 additions and 112 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ GEM
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
secure_headers (6.5.0)
selenium-devtools (0.128.0)
selenium-devtools (0.129.0)
selenium-webdriver (~> 4.2)
selenium-webdriver (4.25.0)
base64 (~> 0.2)
Expand Down Expand Up @@ -1172,7 +1172,7 @@ GEM
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.8.1)
webrick (1.8.2)
websocket (1.2.11)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
Expand Down
2 changes: 1 addition & 1 deletion docker/prod/artifacthub-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# when the hash of the last commit in the branch you set up changes. This does
# NOT apply to ownership claim operations, which are processed immediately.
#
repositoryID: openproject
repositoryID: 25516830-632d-470a-8eb8-6a5da9b48192
owners:
- name: oliverguenther
email: [email protected]
Expand Down
12 changes: 6 additions & 6 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ def has_ampf_configuration_error?

def capabilities
@capabilities ||= Peripherals::Registry
.resolve("#{@storage.short_provider_type}.queries.capabilities")
.resolve("#{@storage}.queries.capabilities")
.call(storage: @storage, auth_strategy: noop)
end

def files
@files ||= Peripherals::Registry
.resolve("#{@storage.short_provider_type}.queries.files")
.resolve("#{@storage}.queries.files")
.call(storage: @storage, auth_strategy: userless, folder: ParentFolder.new(@storage.group_folder))
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def validate

def query
@query ||= Peripherals::Registry
.resolve("#{@storage.short_provider_type}.queries.files")
.resolve("#{@storage}.queries.files")
.call(storage: @storage, auth_strategy:, folder: root_folder)
end

Expand Down Expand Up @@ -173,7 +173,7 @@ def root_folder
end

def auth_strategy
Peripherals::Registry.resolve("#{@storage.short_provider_type}.authentication.userless")
Peripherals::Registry.resolve("#{@storage}.authentication.userless")
.call
.with_cache(false)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def self.authorization_state(storage:, user:)
auth_strategy = AuthenticationStrategies::OAuthUserToken.strategy.with_user(user)

Registry
.resolve("#{storage.short_provider_type}.queries.auth_check")
.resolve("#{storage}.queries.auth_check")
.call(storage:, auth_strategy:)
.match(
on_success: ->(*) { :connected },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ module Inputs
private_class_method :new

def self.build(folder_id:, file_name:, contract: UploadDataContract.new)
contract.call(folder_id:, file_name:).to_monad.fmap do |result|
new(file_name: result[:file_name], folder_id: ParentFolder.new(result[:folder_id]))
end
contract.call(folder_id:, file_name:)
.to_monad
.fmap { |result| new(file_name: result[:file_name], folder_id: result[:folder_id]) }
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
) do |form|
flex_layout do |oauth_client_row|
oauth_client_row.with_row(mb: 3) do
render(Primer::Beta::Text.new(font_weight: :bold)) { I18n.t("storages.file_storage_view.#{storage.short_provider_type}_oauth") }
render(Primer::Beta::Text.new(font_weight: :bold)) { I18n.t("storages.file_storage_view.#{storage}_oauth") }
end

oauth_client_row.with_row(mb: 3) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def cancel_button_path
end

def storage_provider_credentials_instructions
I18n.t("storages.instructions.#{storage.short_provider_type}.oauth_configuration",
application_link_text: send(:"#{storage.short_provider_type}_integration_link")).html_safe
I18n.t("storages.instructions.#{storage}.oauth_configuration",
application_link_text: send(:"#{storage}_integration_link")).html_safe
end

private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
concat(
render(
Primer::Beta::Text.new(font_weight: :bold, mr: 1, test_selector: 'storage-oauth-client-label')
) { I18n.t("storages.file_storage_view.#{storage.short_provider_type}_oauth") }
) { I18n.t("storages.file_storage_view.#{storage}_oauth") }
)
concat(configuration_check_label_for(:storage_oauth_client_configured))
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def self.wrapper_key = :storage_oauth_client_section

def edit_icon_button_options
label = I18n.t("storages.buttons.replace_oauth_client",
provider_type: I18n.t("storages.provider_types.#{storage.short_provider_type}.name"))
provider_type: I18n.t("storages.provider_types.#{storage}.name"))

{
icon: oauth_client_configured? ? :sync : :pencil,
Expand All @@ -64,7 +64,7 @@ def edit_icon_button_options
def edit_icon_button_data_options
{}.tap do |data_h|
if oauth_client_configured?
provider_type = I18n.t("storages.provider_types.#{storage.short_provider_type}.name")
provider_type = I18n.t("storages.provider_types.#{storage}.name")
data_h[:turbo_confirm] = I18n.t("storages.confirm_replace_oauth_client", provider_type:)
end
data_h[:turbo_stream] = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
end

grid.with_area(:provider, tag: :div, color: :subtle, mr: 3, hide: :sm, data: { 'test-selector': 'storage-provider' }) do
render(Primer::Beta::Truncate.new(font_weight: :light)) { I18n.t("storages.provider_types.#{storage.short_provider_type}.name") }
render(Primer::Beta::Truncate.new(font_weight: :light)) { I18n.t("storages.provider_types.#{storage}.name") }
end

grid.with_area(:time, tag: :div, color: :subtle) do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# 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::Admin
module StorageViewInformation
private
Expand All @@ -9,7 +37,7 @@ def editable_storage?
end

def storage_description
[I18n.t("storages.provider_types.#{storage.short_provider_type}.name"),
[I18n.t("storages.provider_types.#{storage}.name"),
storage.name,
storage.host].compact.join(" - ")
end
Expand Down Expand Up @@ -62,15 +90,15 @@ def provider_oauth_client_description
if storage.oauth_client
"#{I18n.t('storages.label_oauth_client_id')}: #{storage.oauth_client.client_id}"
else
I18n.t("storages.configuration_checks.oauth_client_incomplete.#{storage.short_provider_type}")
I18n.t("storages.configuration_checks.oauth_client_incomplete.#{storage}")
end
end

def provider_redirect_uri_description
if storage.oauth_client
"#{I18n.t('storages.label_uri')}: #{storage.oauth_client.redirect_uri}"
else
I18n.t("storages.configuration_checks.redirect_uri_incomplete.#{storage.short_provider_type}")
I18n.t("storages.configuration_checks.redirect_uri_incomplete.#{storage}")
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def heading_text = I18n.t("storages.oauth_grant_nudge_modal.heading", provider_t
def waiting_title = I18n.t("storages.oauth_grant_nudge_modal.requesting_access_to", storage: storage.name)
def cancel_button_text = I18n.t(:button_close)
def body_text = I18n.t("storages.oauth_grant_nudge_modal.storage_admin.description", provider_type:)
def provider_type = I18n.t("storages.provider_types.#{storage.short_provider_type}.name")
def provider_type = I18n.t("storages.provider_types.#{storage}.name")

def login_button_aria_label
I18n.t("storages.oauth_grant_nudge_modal.login_button_aria_label", storage: storage.name)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 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
Expand All @@ -24,7 +28,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++

class Storages::OpenProjectStorageModalComponent::Body < ApplicationComponent # rubocop:disable OpenProject/AddPreviewForViewComponent
class Storages::OpenProjectStorageModalComponent::Body < ApplicationComponent
options success_title: I18n.t("storages.open_project_storage_modal.success.title"),
success_subtitle: I18n.t("storages.open_project_storage_modal.success.subtitle"),
waiting_title: I18n.t("storages.open_project_storage_modal.waiting.title"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# -- copyright
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# -- copyright
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# -- copyright
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# -- copyright
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# -- copyright
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
Expand Down Expand Up @@ -45,7 +47,7 @@ def open
# check if user "see" project_folder
if @object.project_folder_id.present?
::Storages::Peripherals::Registry
.resolve("#{@storage.short_provider_type}.queries.file_info")
.resolve("#{@storage}.queries.file_info")
.call(storage: @storage, auth_strategy:, file_id: @object.project_folder_id)
.match(
on_success: user_can_read_project_folder,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
Expand Down Expand Up @@ -58,7 +60,7 @@ def provider_type_link
href: Storages::UrlBuilder.url(@storage.uri, "settings/admin/openproject"),
target: "_blank"
)
) { I18n.t("storages.instructions.#{@storage.short_provider_type}.integration") }
) { I18n.t("storages.instructions.#{@storage}.integration") }
end
end
end
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
Expand Down Expand Up @@ -69,11 +71,11 @@ def provider_default_client_secret_input_options
end

def label_client_id
I18n.t("storages.provider_types.#{@storage.short_provider_type}.label_oauth_client_id")
I18n.t("storages.provider_types.#{@storage}.label_oauth_client_id")
end

def label_client_secret
I18n.t("storages.provider_types.#{@storage.short_provider_type}.label_oauth_client_secret")
I18n.t("storages.provider_types.#{@storage}.label_oauth_client_secret")
end
end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# -- copyright
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
Expand All @@ -26,7 +26,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
# ++
#++
#

# This filter is used to find projects (including archived projects) that use one
Expand Down
6 changes: 3 additions & 3 deletions modules/storages/app/models/storages/project_storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ def open(user)

if project_folder_not_accessible?(user)
Peripherals::Registry
.resolve("#{storage.short_provider_type}.queries.open_storage")
.resolve("#{storage}.queries.open_storage")
.call(storage:, auth_strategy:)
else
Peripherals::Registry
.resolve("#{storage.short_provider_type}.queries.open_file_link")
.resolve("#{storage}.queries.open_file_link")
.call(storage:, auth_strategy:, file_id: project_folder_id)
end
end
Expand All @@ -118,7 +118,7 @@ def open_with_connection_ensured

def managed_folder_identifier
@managed_folder_identifier ||=
Peripherals::Registry.resolve("#{storage.short_provider_type}.models.managed_folder_identifier").new(self)
Peripherals::Registry.resolve("#{storage}.models.managed_folder_identifier").new(self)
end

def project_folder_not_accessible?(user)
Expand Down
Loading

0 comments on commit 9613fe4

Please sign in to comment.