OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
static op/authentication
ulferts49471bbd661f
diff --git a/config/application.rb b/config/application.rbindex b88fea55c3f..22a16c8c277 100644--- a/config/application.rb+++ b/config/application.rb@@ -39,18 +39,6 @@ ActiveSupport::Deprecation.silenced =(Rails.env.test? && ENV['CI'])if defined?(Bundler)- # lib directory has to be added to the load path so that- # the open_project/plugins files can be found (places under lib).- # Now it would be possible to remove that and use require with- # lib included but some plugins already use- #- # require 'open_project/plugins'- #- # to ensure the code to be loaded. So we provide a compatibility- # layer here. One might remove this later.- $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'- require 'open_project/plugins'-# Require the gems listed in Gemfile, including any gems# you've limited to :test, :development, or :production.Bundler.require(*Rails.groups(:opf_plugins))@@ -103,6 +91,10 @@ module OpenProjectconfig.paths.add Rails.root.join('lib').to_s, eager_load: trueconfig.paths.add Rails.root.join('lib/constraints').to_s, eager_load: true+ # Constants in lib_static should only be loaded once and never be unloaded.+ # That directory contains configurations and patches to rails core functionality.+ config.autoload_once_paths << Rails.root.join('lib_static').to_s+# Use our own error rendering for prettier error pagesconfig.exceptions_app = routesdiff --git a/config/initializers/00-load_lib_static.rb b/config/initializers/00-load_plugins.rbsimilarity index 83%rename from config/initializers/00-load_lib_static.rbrename to config/initializers/00-load_plugins.rbindex ebf63d54583..cce972bb14f 100644--- a/config/initializers/00-load_lib_static.rb+++ b/config/initializers/00-load_plugins.rb@@ -28,14 +28,6 @@# TODO: check if this can be postponed and if some plugins can make use of the ActiveSupport.on_load hooks-require Rails.root.join('lib_static/redmine/i18n')-require Rails.root.join('lib_static/redmine/diff')-require Rails.root.join('lib_static/redmine/diff/diffable')-require Rails.root.join('lib_static/redmine/diff/array_string_diff')--require Rails.root.join('lib_static/plugins/load_path_helper')-require Rails.root.join('lib_static/open_project/notifications')-# Loads the core plugins located in lib_static/pluginsDir.glob(Rails.root.join('lib_static/plugins/*')).each do |directory|if File.directory?(directory)diff --git a/config/initializers/warden.rb b/config/initializers/warden.rbindex 9623f22d683..efc05c9bf64 100644--- a/config/initializers/warden.rb+++ b/config/initializers/warden.rb@@ -1,32 +1,20 @@-require 'open_project/authentication'+Rails.application.config.after_initialize do+ WS = OpenProject::Authentication::Strategies::Warden-# Strategies provided by OpenProject:-require 'open_project/authentication/strategies/warden/basic_auth_failure'-require 'open_project/authentication/strategies/warden/global_basic_auth'-require 'open_project/authentication/strategies/warden/user_basic_auth'-require 'open_project/authentication/strategies/warden/doorkeeper_oauth'-require 'open_project/authentication/strategies/warden/session'+ strategies = [+ [:basic_auth_failure, WS::BasicAuthFailure, 'Basic'],+ [:global_basic_auth, WS::GlobalBasicAuth, 'Basic'],+ [:user_basic_auth, WS::UserBasicAuth, 'Basic'],+ [:oauth, WS::DoorkeeperOAuth, 'OAuth'],+ [:anonymous_fallback, WS::AnonymousFallback, 'Basic'],+ [:session, WS::Session, 'Session']+ ]-WS = OpenProject::Authentication::Strategies::Warden+ strategies.each do |name, clazz, auth_scheme|+ OpenProject::Authentication.add_strategy name, clazz, auth_scheme+ end-strategies = [- [:basic_auth_failure, WS::BasicAuthFailure, 'Basic'],- [:global_basic_auth, WS::GlobalBasicAuth, 'Basic'],- [:user_basic_auth, WS::UserBasicAuth, 'Basic'],- [:oauth, WS::DoorkeeperOAuth, 'OAuth'],- [:anonymous_fallback, WS::AnonymousFallback, 'Basic'],- [:session, WS::Session, 'Session']-]--strategies.each do |name, clazz, auth_scheme|- OpenProject::Authentication.add_strategy name, clazz, auth_scheme-end--include OpenProject::Authentication::Scope--api_v3_options = {- store: false-}-OpenProject::Authentication.update_strategies(API_V3, api_v3_options) do |_strategies|- %i[global_basic_auth user_basic_auth basic_auth_failure oauth session anonymous_fallback]+ OpenProject::Authentication.update_strategies(OpenProject::Authentication::Scope::API_V3, { store: false }) do |_|+ %i[global_basic_auth user_basic_auth basic_auth_failure oauth session anonymous_fallback]+ endenddiff --git a/lib/open_project/authentication.rb b/lib_static/open_project/authentication.rbsimilarity index 89%rename from lib/open_project/authentication.rbrename to lib_static/open_project/authentication.rbindex f1a5ba31c88..a5af59b24d0 100644--- a/lib/open_project/authentication.rb+++ b/lib_static/open_project/authentication.rb@@ -1,3 +1,29 @@+# OpenProject is an open source project management software.+# Copyright (C) 2022 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 'open_project/authentication/manager'module OpenProjectdiff --git a/lib/open_project/authentication/failure_app.rb b/lib_static/open_project/authentication/failure_app.rbsimilarity index 100%rename from lib/open_project/authentication/failure_app.rbrename to lib_static/open_project/authentication/failure_app.rbdiff --git a/lib/open_project/authentication/manager.rb b/lib_static/open_project/authentication/manager.rbsimilarity index 100%rename from lib/open_project/authentication/manager.rbrename to lib_static/open_project/authentication/manager.rbdiff --git a/lib/open_project/authentication/session_expiry.rb b/lib_static/open_project/authentication/session_expiry.rbsimilarity index 100%rename from lib/open_project/authentication/session_expiry.rbrename to lib_static/open_project/authentication/session_expiry.rbdiff --git a/lib/open_project/authentication/strategies/warden/anonymous_fallback.rb b/lib_static/open_project/authentication/strategies/warden/anonymous_fallback.rbsimilarity index 100%rename from lib/open_project/authentication/strategies/warden/anonymous_fallback.rbrename to lib_static/open_project/authentication/strategies/warden/anonymous_fallback.rbdiff --git a/lib/open_project/authentication/strategies/warden/basic_auth_failure.rb b/lib_static/open_project/authentication/strategies/warden/basic_auth_failure.rbsimilarity index 100%rename from lib/open_project/authentication/strategies/warden/basic_auth_failure.rbrename to lib_static/open_project/authentication/strategies/warden/basic_auth_failure.rbdiff --git a/lib/open_project/authentication/strategies/warden/doorkeeper_oauth.rb b/lib_static/open_project/authentication/strategies/warden/doorkeeper_oauth.rbsimilarity index 100%rename from lib/open_project/authentication/strategies/warden/doorkeeper_oauth.rbrename to lib_static/open_project/authentication/strategies/warden/doorkeeper_oauth.rbdiff --git a/lib/open_project/authentication/strategies/warden/global_basic_auth.rb b/lib_static/open_project/authentication/strategies/warden/global_basic_auth.rbsimilarity index 100%rename from lib/open_project/authentication/strategies/warden/global_basic_auth.rbrename to lib_static/open_project/authentication/strategies/warden/global_basic_auth.rbdiff --git a/lib/open_project/authentication/strategies/warden/session.rb b/lib_static/open_project/authentication/strategies/warden/session.rbsimilarity index 100%rename from lib/open_project/authentication/strategies/warden/session.rbrename to lib_static/open_project/authentication/strategies/warden/session.rbdiff --git a/lib/open_project/authentication/strategies/warden/user_basic_auth.rb b/lib_static/open_project/authentication/strategies/warden/user_basic_auth.rbsimilarity index 100%rename from lib/open_project/authentication/strategies/warden/user_basic_auth.rbrename to lib_static/open_project/authentication/strategies/warden/user_basic_auth.rbdiff --git a/modules/bim/lib/open_project/bim/engine.rb b/modules/bim/lib/open_project/bim/engine.rbindex b6944aa87a0..712c4976301 100644--- a/modules/bim/lib/open_project/bim/engine.rb+++ b/modules/bim/lib/open_project/bim/engine.rb@@ -199,16 +199,18 @@ module OpenProject::BimMime::Type.register "application/octet-stream", :bcfzip unless Mime::Type.lookup_by_extension(:bcfzip)end- initializer 'bim.bcf.add_api_scope' do- Doorkeeper.configuration.scopes.add(:bcf_v2_1)+ initializer 'bim.bcf.add_api_scope' do |app|+ app.config.before_initialize do+ Doorkeeper.configuration.scopes.add(:bcf_v2_1)- module OpenProject::Authentication::Scope- BCF_V2_1 = :bcf_v2_1- end+ module OpenProject::Authentication::Scope+ BCF_V2_1 = :bcf_v2_1+ end- OpenProject::Authentication.update_strategies(OpenProject::Authentication::Scope::BCF_V2_1,- store: false) do |_strategies|- %i[oauth session]+ OpenProject::Authentication.update_strategies(OpenProject::Authentication::Scope::BCF_V2_1,+ store: false) do |_strategies|+ %i[oauth session]+ endendend