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

[#53718] added access management form section

Eric Schubert3c5113ae65ef
diff --git a/modules/storages/app/components/storages/admin/access_management_component.html.erb b/modules/storages/app/components/storages/admin/access_management_component.html.erb
new file mode 100644
index 00000000000..0f5d8991321
--- /dev/null
+++ b/modules/storages/app/components/storages/admin/access_management_component.html.erb
@@ -0,0 +1,34 @@
+<%=
+ grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|
+ grid.with_area(:item, tag: :div, mr: 3) do
+ concat(render(Primer::Beta::Text.new(font_weight: :bold, mr: 1, test_selector: 'access-management-label')) do
+ I18n.t('storages.file_storage_view.access_management.subtitle')
+ end)
+ concat(configuration_check_label_for(:access_management_configured))
+ end
+
+ grid.with_area(:description, tag: :div, color: :subtle, test_selector: 'access-management-description') do
+ render(Primer::Beta::Text.new) { access_management_description }
+ end
+
+ if editable_storage?
+ grid.with_area(:"icon-button", tag: :div, color: :muted) do
+ flex_layout(justify_content: :flex_end) do |icons_container|
+ icons_container.with_column do
+ render(
+ Primer::Beta::IconButton.new(
+ icon: :pencil,
+ tag: :a,
+ scheme: :invisible,
+ href: edit_admin_settings_storage_access_management_path(storage),
+ aria: { label: I18n.t('storages.label_edit_storage_access_management') },
+ test_selector: 'storage-edit-access-management-button',
+ data: { turbo_stream: true }
+ )
+ )
+ end
+ end
+ end
+ end
+ end
+%>
diff --git a/modules/storages/app/components/storages/admin/access_management_component.rb b/modules/storages/app/components/storages/admin/access_management_component.rb
new file mode 100644
index 00000000000..21adaff978e
--- /dev/null
+++ b/modules/storages/app/components/storages/admin/access_management_component.rb
@@ -0,0 +1,53 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 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
+ class AccessManagementComponent < ApplicationComponent
+ include OpPrimer::ComponentHelpers
+ include StorageViewInformation
+
+ alias_method :storage, :model
+
+ private
+
+ def access_management_description
+ if storage.automatic_management_new_record?
+ return I18n.t("storages.file_storage_view.access_management.setup_incomplete")
+ end
+
+ case storage.automatic_management_enabled
+ when true
+ I18n.t("storages.file_storage_view.access_management.automatic_management")
+ when false
+ I18n.t("storages.file_storage_view.access_management.manual_management")
+ end
+ end
+ end
+end
diff --git a/modules/storages/app/components/storages/admin/forms/access_management_form_component.html.erb b/modules/storages/app/components/storages/admin/forms/access_management_form_component.html.erb
new file mode 100644
index 00000000000..f8a28e105a9
--- /dev/null
+++ b/modules/storages/app/components/storages/admin/forms/access_management_form_component.html.erb
@@ -0,0 +1,34 @@
+<%=
+ render(Primer::Beta::Text.new(tag: :div, test_selector: 'storage-access-management-form')) do
+ primer_form_with(
+ model:,
+ url: admin_settings_storage_access_management_path(storage),
+ method: :post
+ ) do |form|
+ flex_layout do |access_management_row|
+ access_management_row.with_row(mb: 3) do
+ render(Primer::Beta::Text.new(font_weight: :bold)) { I18n.t(:'storages.file_storage_view.access_management.subtitle') }
+ end
+
+ access_management_row.with_row(mb: 3) do
+ render(Primer::Beta::Text.new) { I18n.t(:'storages.file_storage_view.access_management.description') }
+ end
+
+ access_management_row.with_row do
+ render(Storages::Admin::AccessManagementForm.new(form, storage:))
+ end
+
+ access_management_row.with_row do
+ render(
+ Storages::Admin::SubmitOrCancelForm.new(
+ form,
+ storage:,
+ submit_button_options: {},
+ cancel_button_options: { href: cancel_button_path }
+ )
+ )
+ end
+ end
+ end
+ end
+%>
diff --git a/modules/storages/app/components/storages/admin/forms/access_management_form_component.rb b/modules/storages/app/components/storages/admin/forms/access_management_form_component.rb
new file mode 100644
index 00000000000..779b1b4fce8
--- /dev/null
+++ b/modules/storages/app/components/storages/admin/forms/access_management_form_component.rb
@@ -0,0 +1,42 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 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::Forms
+ class AccessManagementFormComponent < ApplicationComponent
+ include OpPrimer::ComponentHelpers
+ alias_method :storage, :model
+
+ private
+
+ def cancel_button_path
+ edit_admin_settings_storage_path(storage)
+ end
+ end
+end
diff --git a/modules/storages/app/components/storages/admin/forms/general_info_form_component.html.erb b/modules/storages/app/components/storages/admin/forms/general_info_form_component.html.erb
index 6aa624bb9e3..ab570f4ff19 100644
--- a/modules/storages/app/components/storages/admin/forms/general_info_form_component.html.erb
+++ b/modules/storages/app/components/storages/admin/forms/general_info_form_component.html.erb
@@ -32,25 +32,6 @@
end
if storage.provider_type_one_drive?
- general_info_row.with_row(mb: 3) do
- render(Primer::Beta::Text.new(font_weight: :bold)) { I18n.t(:'storages.label_managed_project_folders.automatically_managed_folders') }
- end
-
- general_info_row.with_row(mb: 3) do
- render(Primer::Beta::Text.new) { I18n.t("storages.page_titles.managed_project_folders.subtitle") }
- end
-
- general_info_row.with_row(mb: 3) do
- render(Storages::Admin::ManagedProjectFolders::AutomaticManagementCheckbox.new(form, storage:))
- end
-
- general_info_row.with_row(mb: 3,
- data: {
- 'storages--automatically-managed-project-folders-form-target': "oneDriveInformationText"
- }) do
- render(Primer::Beta::Text.new) { information_for_one_drive_automatic_management }
- end
-
general_info_row.with_row(mb: 3) do
render(Storages::Admin::ProviderDriveIdInputForm.new(form))
end
diff --git a/modules/storages/app/components/storages/admin/forms/general_info_form_component.rb b/modules/storages/app/components/storages/admin/forms/general_info_form_component.rb
index e2799ad5810..788c426a4c6 100644
--- a/modules/storages/app/components/storages/admin/forms/general_info_form_component.rb
+++ b/modules/storages/app/components/storages/admin/forms/general_info_form_component.rb
@@ -89,16 +89,6 @@ module Storages::Admin::Forms
).html_safe
end
- def information_for_one_drive_automatic_management
- href = ::OpenProject::Static::Links[:storage_docs][:one_drive_drive_id_guide][:href]
- I18n.t(
- "storages.page_titles.managed_project_folders.one_drive_information",
- drive_id_link_text: render(Primer::Beta::Link.new(href:, target: "_blank")) do
- I18n.t("storages.instructions.one_drive.documentation_link_text")
- end
- ).html_safe
- end
-
def application_link_text_for(href, link_text)
render(Primer::Beta::Link.new(href:, target: "_blank")) { link_text }
end
diff --git a/modules/storages/app/components/storages/admin/storage_view_component.html.erb b/modules/storages/app/components/storages/admin/storage_view_component.html.erb
index 12c8930ca8c..fc9a61aca75 100644
--- a/modules/storages/app/components/storages/admin/storage_view_component.html.erb
+++ b/modules/storages/app/components/storages/admin/storage_view_component.html.erb
@@ -59,6 +59,20 @@
end
if storage.provider_type_one_drive?
+ component.with_row(scheme: :neutral, color: :muted) do
+ grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|
+ grid.with_area(:item, tag: :div, mr: 3) do
+ render(Primer::Beta::Text.new(font_weight: :semibold, mr: 1)) { I18n.t('storages.file_storage_view.access_management.title') }
+ end
+ end
+ end
+
+ component.with_row(scheme: :default) do
+ render(OpTurbo::FrameComponent.new(id: :access_management_section)) do
+ render(Storages::Admin::AccessManagementComponent.new(storage))
+ end
+ end
+
component.with_row(scheme: :neutral, color: :muted) do
grid_layout('op-storage-view--row', tag: :div, align_items: :center) do |grid|
grid.with_area(:item, tag: :div, mr: 3) do
diff --git a/modules/storages/app/controllers/storages/admin/access_management_controller.rb b/modules/storages/app/controllers/storages/admin/access_management_controller.rb
new file mode 100644
index 00000000000..bd2e1201fd1
--- /dev/null
+++ b/modules/storages/app/controllers/storages/admin/access_management_controller.rb
@@ -0,0 +1,101 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 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.
+#++
+
+class Storages::Admin::AccessManagementController < ApplicationController
+ layout "admin"
+
+ before_action :require_admin
+
+ model_object Storages::OneDriveStorage
+ before_action :find_model_object, only: %i[new create edit]
+
+ # menu_item is defined in the Redmine::MenuManager::MenuController
+ # module, included from ApplicationController.
+ # The menu item is defined in the engine.rb
+ menu_item :storages_admin_settings
+
+ # Show the admin page to set storage folder automatic management (for an already existing storage).
+ # Sets the attributes automatically_managed as default true unless already set to false
+ # renders a form (allowing the user to change automatically_managed bool and password).
+ # Used by: The OauthClientsController#create, after the user inputs Oauth credentials for the first time.
+ # Called by: Global app/config/routes.rb to serve Web page
+ def new
+ respond_to do |format|
+ format.turbo_stream
+ end
+ end
+
+ def create
+ service_result = call_update_service
+
+ service_result.on_success do
+ respond_to { |format| format.turbo_stream }
+ end
+
+ service_result.on_failure do
+ respond_to do |format|
+ format.turbo_stream { render :edit }
+ end
+ end
+ end
+
+ def edit
+ respond_to do |format|
+ format.turbo_stream
+ end
+ end
+
+ def default_breadcrumb
+ ActionController::Base.helpers.link_to(t(:project_module_storages), admin_settings_storages_path)
+ end
+
+ def show_local_breadcrumb
+ true
+ end
+
+ private
+
+ def find_model_object(object_id = :storage_id)
+ super(object_id)
+ @storage = @object
+ end
+
+ def call_update_service
+ ::Storages::Storages::UpdateService
+ .new(user: current_user, model: @storage)
+ .call(permitted_storage_params)
+ end
+
+ def permitted_storage_params
+ params
+ .require(:storages_one_drive_storage)
+ .permit("automatic_management_enabled")
+ end
+end
diff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rb
index 7491bd2c6bd..f412710a9b9 100644
--- a/modules/storages/app/controllers/storages/admin/storages_controller.rb
+++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb
@@ -112,10 +112,12 @@ class Storages::Admin::StoragesController < ApplicationController
end
service_result.on_success do
- service_result.on_success do
- respond_to do |format|
- format.turbo_stream
- end
+ if @storage.provider_type_one_drive?
+ prepare_storage_for_access_management_form
+ end
+
+ respond_to do |format|
+ format.turbo_stream
end
end
end
@@ -213,6 +215,15 @@ class Storages::Admin::StoragesController < ApplicationController
private
+ def prepare_storage_for_access_management_form
+ return unless @storage.automatic_management_unspecified?
+
+ @storage = ::Storages::Storages::SetProviderFieldsAttributesService
+ .new(user: current_user, model: @storage, contract_class: EmptyContract)
+ .call
+ .result
+ end
+
def ensure_valid_provider_type_selected
short_provider_type = params[:provider]
if short_provider_type.blank? || (@provider_type = ::Storages::Storage::PROVIDER_TYPE_SHORT_NAMES[short_provider_type]).blank?
diff --git a/modules/storages/app/forms/storages/admin/access_management_form.rb b/modules/storages/app/forms/storages/admin/access_management_form.rb
new file mode 100644
index 00000000000..a2fa07bced9
--- /dev/null
+++ b/modules/storages/app/forms/storages/admin/access_management_form.rb
@@ -0,0 +1,58 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 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
+ class AccessManagementForm < ApplicationForm
+ form do |access_management_form|
+ access_management_form.radio_button_group(name: :access_management) do |radio_buttons|
+ radio_buttons.radio_button(
+ name: :automatic_management_enabled,
+ value: true,
+ checked: @storage.automatic_management_enabled?,
+ label: I18n.t("storages.file_storage_view.access_management.automatic_management"),
+ caption: I18n.t("storages.file_storage_view.access_management.automatic_management_description"),
+ visually_hide_label: false
+ )
+
+ radio_buttons.radio_button(
+ name: :automatic_management_enabled,
+ value: false,
+ checked: [email protected]_management_enabled?,
+ label: I18n.t("storages.file_storage_view.access_management.manual_management"),
+ caption: I18n.t("storages.file_storage_view.access_management.manual_management_description"),
+ visually_hide_label: false
+ )
+ end
+ end
+
+ def initialize(storage:)
+ super()
+ @storage = storage
+ end
+ end
+end
diff --git a/modules/storages/app/models/storages/one_drive_storage.rb b/modules/storages/app/models/storages/one_drive_storage.rb
index 5365da2b291..794aeaa620e 100644
--- a/modules/storages/app/models/storages/one_drive_storage.rb
+++ b/modules/storages/app/models/storages/one_drive_storage.rb
@@ -47,6 +47,15 @@ module Storages
}
end
+ def automatic_management_new_record?
+ if provider_fields_changed?
+ previous_configuration = provider_fields_change.first
+ previous_configuration.values_at("automatically_managed").compact.empty?
+ else
+ automatic_management_unspecified?
+ end
+ end
+
def oauth_configuration
Peripherals::OAuthConfigurations::OneDriveConfiguration.new(self)
end
diff --git a/modules/storages/app/models/storages/storage.rb b/modules/storages/app/models/storages/storage.rb
index 8901a99b25c..87ea4b52f4d 100644
--- a/modules/storages/app/models/storages/storage.rb
+++ b/modules/storages/app/models/storages/storage.rb
@@ -41,8 +41,8 @@
module Storages
class Storage < ApplicationRecord
PROVIDER_TYPES = [
- PROVIDER_TYPE_NEXTCLOUD = 'Storages::NextcloudStorage',
- PROVIDER_TYPE_ONE_DRIVE = 'Storages::OneDriveStorage'
+ PROVIDER_TYPE_NEXTCLOUD = "Storages::NextcloudStorage",
+ PROVIDER_TYPE_ONE_DRIVE = "Storages::OneDriveStorage"
].freeze
PROVIDER_TYPE_SHORT_NAMES = {
@@ -54,12 +54,12 @@ module Storages
store_attribute :provider_fields, :automatically_managed, :boolean
- has_many :file_links, class_name: 'Storages::FileLink'
- belongs_to :creator, class_name: 'User'
- has_many :project_storages, dependent: :destroy, class_name: 'Storages::ProjectStorage'
+ has_many :file_links, class_name: "Storages::FileLink"
+ belongs_to :creator, class_name: "User"
+ has_many :project_storages, dependent: :destroy, class_name: "Storages::ProjectStorage"
has_many :projects, through: :project_storages
has_one :oauth_client, as: :integration, dependent: :destroy
- has_one :oauth_application, class_name: '::Doorkeeper::Application', as: :integration, dependent: :destroy
+ has_one :oauth_application, class_name: "::Doorkeeper::Application", as: :integration, dependent: :destroy
validates_uniqueness_of :host, allow_nil: true
validates_uniqueness_of :name
@@ -83,9 +83,9 @@ module Storages
scope :automatic_management_enabled, -> { where("provider_fields->>'automatically_managed' = 'true'") }
enum health_status: {
- pending: 'pending',
- healthy: 'healthy',
- unhealthy: 'unhealthy'
+ pending: "pending",
+ healthy: "healthy",
+ unhealthy: "unhealthy"
}.freeze, _prefix: :health
def self.shorten_provider_type(provider_type)
@@ -107,7 +107,7 @@ module Storages
def self.extract_part_from_piped_string(text, index)
return if text.nil?
- split_reason = text.split('|')
+ split_reason = text.split("|")
if split_reason.length > index
split_reason[index].strip
end
@@ -115,8 +115,8 @@ module Storages
def automatically_managed?
ActiveSupport::Deprecation.warn(
- '`#automatically_managed?` is deprecated. Use `#automatic_management_enabled?` instead. ' \
- 'NOTE: The new method name better reflects the actual behavior of the storage. ' \
+ "`#automatically_managed?` is deprecated. Use `#automatic_management_enabled?` instead. " \
+ "NOTE: The new method name better reflects the actual behavior of the storage. " \
"It's not the storage that is automatically managed, rather the Project (Storage) Folder is. " \
"A storage only has this feature enabled or disabled."
)
@@ -160,6 +160,10 @@ module Storages
raise Errors::SubclassResponsibility
end
+ def automatic_management_new_record?
+ raise Errors::SubclassResponsibility
+ end
+
def provider_fields_defaults
raise Errors::SubclassResponsibility
end
diff --git a/modules/storages/app/views/storages/admin/access_management/create.turbo_stream.erb b/modules/storages/app/views/storages/admin/access_management/create.turbo_stream.erb
new file mode 100644
index 00000000000..af2284c56a1
--- /dev/null
+++ b/modules/storages/app/views/storages/admin/access_management/create.turbo_stream.erb
@@ -0,0 +1,36 @@
+<%#-- copyright
+OpenProject is an open source project management software.
+Copyright (C) 2012-2024 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.
+
+++#%>
+
+<%= turbo_stream.update :access_management_section do %>
+ <%= render(Storages::Admin::AccessManagementComponent.new(@storage)) %>
+<% end %>
+
+<%= turbo_stream.update :storage_oauth_client_section do %>
+ <%= render(Storages::Admin::Forms::OAuthClientFormComponent.new(oauth_client: @storage.build_oauth_client, storage: @storage)) %>
+<% end %>
diff --git a/modules/storages/app/views/storages/admin/access_management/edit.turbo_stream.erb b/modules/storages/app/views/storages/admin/access_management/edit.turbo_stream.erb
new file mode 100644
index 00000000000..95959714723
--- /dev/null
+++ b/modules/storages/app/views/storages/admin/access_management/edit.turbo_stream.erb
@@ -0,0 +1,32 @@
+<%#-- copyright
+OpenProject is an open source project management software.
+Copyright (C) 2012-2024 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.
+
+++#%>
+
+<%= turbo_stream.update :access_management_section do %>
+ <%= render(Storages::Admin::Forms::AccessManagementFormComponent.new(@storage)) %>
+<% end %>
diff --git a/modules/storages/app/views/storages/admin/storages/create.turbo_stream.erb b/modules/storages/app/views/storages/admin/storages/create.turbo_stream.erb
index f679e4ace0d..96000a151d5 100644
--- a/modules/storages/app/views/storages/admin/storages/create.turbo_stream.erb
+++ b/modules/storages/app/views/storages/admin/storages/create.turbo_stream.erb
@@ -48,7 +48,7 @@ See COPYRIGHT and LICENSE files for more details.
<% end %>
<% if @storage.provider_type_one_drive? %>
- <%= turbo_stream.update :storage_oauth_client_section do %>
- <%= render(Storages::Admin::Forms::OAuthClientFormComponent.new(oauth_client: @storage.build_oauth_client, storage: @storage)) %>
+ <%= turbo_stream.update :access_management_section do %>
+ <%= render(Storages::Admin::Forms::AccessManagementFormComponent.new(@storage)) %>
<% end %>
<% end %>
diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.yml
index 5f0a157e464..e0acc1e502e 100644
--- a/modules/storages/config/locales/en.yml
+++ b/modules/storages/config/locales/en.yml
@@ -78,6 +78,15 @@ en:
storage_delete_result_3: In case this storage has automatically managed project folders, those and their contained files will be deleted forever.
error_invalid_provider_type: Please select a valid storage provider.
file_storage_view:
+ access_management:
+ automatic_management: Automatically managed access and folders
+ automatic_management_description: Let OpenProject create folders per project automatically and manage its user access. This is recommended as it ensures that every team member has always the correct access permissions.
+ description: Select the type of management of user access and folder creation. We recommend to use the Automatically managed access to have a more organised structure and guarantee access to all relevant users.
+ manual_management: Manually managed access and folders
+ manual_management_description: Create and manage folders per project manually on your own. You will need to manually ensure relevant users have access.
+ setup_incomplete: Select the type of management of user access and folder creation.
+ subtitle: Access management
+ title: Access and project folders
automatically_managed_folders: Automatically managed folders
general_information: General information
nextcloud_oauth: Nextcloud OAuth
@@ -144,6 +153,7 @@ en:
label_creator: Creator
label_delete_storage: Delete storage
label_edit_storage: Edit storage
+ label_edit_storage_access_management: Edit storage access management
label_edit_storage_automatically_managed_folders: Edit storage automatically managed folders
label_edit_storage_host: Edit storage host
label_existing_manual_folder: Existing folder with manually managed permissions
@@ -200,11 +210,6 @@ en:
delete: Delete file storage
subtitle: Add an external file storage in order to upload, link and manage files in work packages.
managed_project_folders:
- one_drive_information: |-
- To enable automatically managed project folders in OneDrive/SharePoint, additional configuration is needed on
- the drive that is used for this file storage. If OpenProject manages the permissions of this drive, it will
- most likely be unusable for other use cases in SharePoint. For more information and guidance please refer
- to the %{drive_id_link_text}.
subtitle: |-
Let OpenProject create folders per project automatically. This is recommended as it ensures that every team
member always has the correct access permissions.
diff --git a/modules/storages/config/routes.rb b/modules/storages/config/routes.rb
index ff40cca7728..1d78e0b8230 100644
--- a/modules/storages/config/routes.rb
+++ b/modules/storages/config/routes.rb
@@ -41,6 +41,8 @@ Rails.application.routes.draw do
resource :automatically_managed_project_folders, controller: "/storages/admin/automatically_managed_project_folders",
only: %i[new create edit update]
+ resource :access_management, controller: "/storages/admin/access_management", only: %i[new create edit]
+
get :select_provider, on: :collection
member do