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
rename method for clarity
ulferts563229dc3efa
diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rbindex 8093becbaf1..1c66dec3058 100644--- a/app/controllers/activities_controller.rb+++ b/app/controllers/activities_controller.rb@@ -30,7 +30,7 @@ class ActivitiesController < ApplicationControllerinclude Layoutmenu_item :activity- before_action :authorize_in_optional_project,+ before_action :load_and_authorize_in_optional_project,:verify_activities_module_activated,:determine_subprojects,:determine_author,diff --git a/app/controllers/concerns/accounts/authorization.rb b/app/controllers/concerns/accounts/authorization.rbindex afb6f4d6e3d..fd5620b6f76 100644--- a/app/controllers/concerns/accounts/authorization.rb+++ b/app/controllers/concerns/accounts/authorization.rb@@ -31,7 +31,7 @@module Accounts::Authorizationextend ActiveSupport::Concern- METHODS_ENFORCING_AUTHORIZATION = %i[require_admin authorize authorize_global authorize_in_optional_project].freeze+ METHODS_ENFORCING_AUTHORIZATION = %i[require_admin authorize authorize_global load_and_authorize_in_optional_project].freezeincluded doclass_attribute :authorization_ensured,@@ -77,7 +77,7 @@ module Accounts::Authorizationend# Find a project based on params[:project_id]- def authorize_in_optional_project+ def load_and_authorize_in_optional_project@project = Project.find(params[:project_id]) if params[:project_id].present?do_authorize({ controller: params[:controller], action: params[:action] }, global: params[:project_id].blank?)diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rbindex 31e664f0e60..5fbf7e6766f 100644--- a/app/controllers/journals_controller.rb+++ b/app/controllers/journals_controller.rb@@ -29,7 +29,7 @@#++class JournalsController < ApplicationController- before_action :authorize_in_optional_project, only: [:index]+ before_action :load_and_authorize_in_optional_project, only: [:index]before_action :find_journal,:ensure_permitted,only: [:diff]diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rbindex a124aac4715..27e9d57ef12 100644--- a/app/controllers/news_controller.rb+++ b/app/controllers/news_controller.rb@@ -36,7 +36,7 @@ class NewsController < ApplicationControllerbefore_action :find_project_from_association, except: %i[new create index]before_action :find_project, only: %i[new create]before_action :authorize, except: [:index]- before_action :authorize_in_optional_project, only: [:index]+ before_action :load_and_authorize_in_optional_project, only: [:index]accept_key_auth :indexdef indexdiff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rbindex a4b26fde274..e29eeb94e44 100644--- a/app/controllers/search_controller.rb+++ b/app/controllers/search_controller.rb@@ -29,7 +29,7 @@class SearchController < ApplicationControllerinclude Layout- before_action :authorize_in_optional_project,+ before_action :load_and_authorize_in_optional_project,:prepare_tokensLIMIT = 10diff --git a/app/controllers/work_packages_controller.rb b/app/controllers/work_packages_controller.rbindex f66dcea7711..d67001318a2 100644--- a/app/controllers/work_packages_controller.rb+++ b/app/controllers/work_packages_controller.rb@@ -36,7 +36,7 @@ class WorkPackagesController < ApplicationControllerbefore_action :authorize_on_work_package,:project, only: :show- before_action :authorize_in_optional_project,+ before_action :load_and_authorize_in_optional_project,:check_allowed_export,:protect_from_unauthorized_export, only: :indexauthorization_checked! only: %i[index show]diff --git a/modules/boards/app/controllers/boards/boards_controller.rb b/modules/boards/app/controllers/boards/boards_controller.rbindex 07e9f85d6b8..165b522196d 100644--- a/modules/boards/app/controllers/boards/boards_controller.rb+++ b/modules/boards/app/controllers/boards/boards_controller.rb@@ -2,7 +2,7 @@ module ::Boardsclass BoardsController < BaseControllerinclude Layout- before_action :authorize_in_optional_project+ before_action :load_and_authorize_in_optional_project# The boards permission alone does not suffice# to view work packagesdiff --git a/modules/calendar/app/controllers/calendar/calendars_controller.rb b/modules/calendar/app/controllers/calendar/calendars_controller.rbindex 2145a5b76e8..9e6a2aa0758 100644--- a/modules/calendar/app/controllers/calendar/calendars_controller.rb+++ b/modules/calendar/app/controllers/calendar/calendars_controller.rb@@ -28,7 +28,7 @@module ::Calendarclass CalendarsController < ApplicationController- before_action :authorize_in_optional_project+ before_action :load_and_authorize_in_optional_projectbefore_action :build_calendar_view, only: %i[new]before_action :authorize, except: %i[index new create]before_action :authorize_global, only: %i[index new create]diff --git a/modules/gantt/app/controllers/gantt/gantt_controller.rb b/modules/gantt/app/controllers/gantt/gantt_controller.rbindex 69289d26747..3b75bcfbc59 100644--- a/modules/gantt/app/controllers/gantt/gantt_controller.rb+++ b/modules/gantt/app/controllers/gantt/gantt_controller.rb@@ -6,7 +6,7 @@ module ::Ganttaccept_key_auth :index- before_action :authorize_in_optional_project, :protect_from_unauthorized_export, only: :index+ before_action :load_and_authorize_in_optional_project, :protect_from_unauthorized_export, only: :indexbefore_action :load_and_validate_query, only: :index, unless: -> { request.format.html? }diff --git a/modules/gantt/app/controllers/gantt/menus_controller.rb b/modules/gantt/app/controllers/gantt/menus_controller.rbindex 3e6cae9bdd8..0708b6a95ca 100644--- a/modules/gantt/app/controllers/gantt/menus_controller.rb+++ b/modules/gantt/app/controllers/gantt/menus_controller.rb@@ -27,7 +27,7 @@# ++module Ganttclass MenusController < ApplicationController- before_action :authorize_in_optional_project+ before_action :load_and_authorize_in_optional_projectdef show@sidebar_menu_items = menu_itemsdiff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rbindex 07b9a2dbc7a..733f4947029 100644--- a/modules/meeting/app/controllers/meetings_controller.rb+++ b/modules/meeting/app/controllers/meetings_controller.rb@@ -28,7 +28,7 @@class MeetingsController < ApplicationControlleraround_action :set_time_zone- before_action :authorize_in_optional_project, only: %i[index new show create history]+ before_action :load_and_authorize_in_optional_project, only: %i[index new show create history]before_action :verify_activities_module_activated, only: %i[history]before_action :determine_date_range, only: %i[history]before_action :determine_author, only: %i[history]diff --git a/modules/reporting/app/controllers/cost_reports_controller.rb b/modules/reporting/app/controllers/cost_reports_controller.rbindex d333cf6430f..81880f56d24 100644--- a/modules/reporting/app/controllers/cost_reports_controller.rb+++ b/modules/reporting/app/controllers/cost_reports_controller.rb@@ -40,7 +40,7 @@ class CostReportsController < ApplicationControllerbefore_action :check_cachebefore_action :load_all- before_action :authorize_in_optional_project+ before_action :load_and_authorize_in_optional_projectbefore_action :find_optional_userinclude Layoutdiff --git a/modules/team_planner/app/controllers/team_planner/team_planner_controller.rb b/modules/team_planner/app/controllers/team_planner/team_planner_controller.rbindex c720fd2ba2a..a2e08ebef42 100644--- a/modules/team_planner/app/controllers/team_planner/team_planner_controller.rb+++ b/modules/team_planner/app/controllers/team_planner/team_planner_controller.rb@@ -2,7 +2,7 @@ module ::TeamPlannerclass TeamPlannerController < BaseControllerinclude EnterpriseTrialHelperinclude Layout- before_action :authorize_in_optional_project+ before_action :load_and_authorize_in_optional_projectbefore_action :build_plan_view, only: %i[new]before_action :require_ee_token, except: %i[upsale]before_action :find_plan_view, only: %i[destroy]diff --git a/spec/controllers/concerns/authorization_spec.rb b/spec/controllers/concerns/authorization_spec.rbindex 61c110c90f4..45296d7eaf8 100644--- a/spec/controllers/concerns/authorization_spec.rb+++ b/spec/controllers/concerns/authorization_spec.rb@@ -46,7 +46,7 @@ RSpec.describe ApplicationController, "enforcement of authorization" do # rubocodef authorize; end- def authorize_in_optional_project; end+ def load_and_authorize_in_optional_project; enddef other_before_action; endend@@ -110,9 +110,9 @@ RSpec.describe ApplicationController, "enforcement of authorization" do # rubocoit_behaves_like "succeeds"end- context "with authorization checked with authorize_in_optional_project" do+ context "with authorization checked with load_and_authorize_in_optional_project" docontroller do- before_action :authorize_in_optional_project+ before_action :load_and_authorize_in_optional_projectinclude controller_setupend