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
allow actions to be called on those not using default authorization before_actions
ulfertsed5a16223002
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rbindex 700a0c132ed..ebb0b295951 100644--- a/app/controllers/account_controller.rb+++ b/app/controllers/account_controller.rb@@ -36,6 +36,7 @@ class AccountController < ApplicationController# prevents login action to be filtered by check_if_login_required application scope filterskip_before_action :check_if_login_required+ no_authorization_required!before_action :apply_csp_appends, only: %i[login]before_action :disable_apidiff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rbindex fee13edbd99..8093becbaf1 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 :find_optional_project,+ before_action :authorize_in_optional_project,:verify_activities_module_activated,:determine_subprojects,:determine_author,diff --git a/app/controllers/angular_controller.rb b/app/controllers/angular_controller.rbindex d44fd99127a..8697a2fb39a 100644--- a/app/controllers/angular_controller.rb+++ b/app/controllers/angular_controller.rb@@ -29,6 +29,8 @@class AngularController < ApplicationControllerbefore_action :require_login+ no_authorization_required!+def empty_layout# Frontend will handle rendering# but we will need to render with layoutdiff --git a/app/controllers/api_docs_controller.rb b/app/controllers/api_docs_controller.rbindex 50ac41572ef..5a1bec3d2ed 100644--- a/app/controllers/api_docs_controller.rb+++ b/app/controllers/api_docs_controller.rb@@ -28,6 +28,7 @@class APIDocsController < ApplicationControllerbefore_action :require_login+ no_authorization_required! only: :indexhelper API::APIDocsHelperdiff --git a/app/controllers/colors_controller.rb b/app/controllers/colors_controller.rbindex 018c6cbfaac..569dacf9540 100644--- a/app/controllers/colors_controller.rb+++ b/app/controllers/colors_controller.rb@@ -28,6 +28,7 @@class ColorsController < ApplicationControllerbefore_action :require_admin_unless_readonly_api_request+ authorization_checked! only: %i[index show new edit create update confirm_destroy destroy]layout "admin"diff --git a/app/controllers/concerns/accounts/omniauth_login.rb b/app/controllers/concerns/accounts/omniauth_login.rbindex efb866c8966..96a7a447531 100644--- a/app/controllers/concerns/accounts/omniauth_login.rb+++ b/app/controllers/concerns/accounts/omniauth_login.rb@@ -38,10 +38,13 @@ module Accounts::OmniauthLogin# the other filters are not applicable either since OmniAuth is doing authentication# itself%i[- verify_authenticity_token user_setup- check_if_login_required check_session_lifetime+ verify_authenticity_token+ user_setup+ check_if_login_required+ check_session_lifetime].each { |key| skip_before_action key, only: [:omniauth_login] }+ no_authorization_required! only: %i[omniauth_login omniauth_failure]helper :omniauthenddiff --git a/app/controllers/custom_styles_controller.rb b/app/controllers/custom_styles_controller.rbindex 692a06ec23f..228c47c8343 100644--- a/app/controllers/custom_styles_controller.rb+++ b/app/controllers/custom_styles_controller.rb@@ -30,12 +30,19 @@ class CustomStylesController < ApplicationControllerlayout "admin"menu_item :custom_style+ UNGUARDED_ACTIONS = %i[logo_download+ export_logo_download+ export_cover_download+ favicon_download+ touch_icon_download].freeze+before_action :require_admin,- except: %i[logo_download export_logo_download export_cover_download favicon_download touch_icon_download]+ except: UNGUARDED_ACTIONSbefore_action :require_ee_token,- except: %i[upsale logo_download export_logo_download export_cover_download favicon_download touch_icon_download]+ except: UNGUARDED_ACTIONS + %i[upsale]skip_before_action :check_if_login_required,- only: %i[logo_download export_logo_download export_cover_download favicon_download touch_icon_download]+ only: UNGUARDED_ACTIONS+ no_authorization_required! only: UNGUARDED_ACTIONSdef show@custom_style = CustomStyle.current || CustomStyle.newdiff --git a/app/controllers/favorites_controller.rb b/app/controllers/favorites_controller.rbindex 6f4cc9c089e..3dc66c8bdea 100644--- a/app/controllers/favorites_controller.rb+++ b/app/controllers/favorites_controller.rb@@ -29,6 +29,7 @@class FavoritesController < ApplicationControllerbefore_action :find_favored_by_objectbefore_action :require_login+ no_authorization_required! only: %i[favorite unfavorite]def favoriteif @favored.visible?(User.current)diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rbindex c305bb1c7f7..ba45fc56000 100644--- a/app/controllers/groups_controller.rb+++ b/app/controllers/groups_controller.rb@@ -31,6 +31,8 @@ class GroupsController < ApplicationControllerlayout "admin"before_action :require_admin, except: %i[show]+ no_authorization_required! only: %i[show]+before_action :find_group, only: %i[destroy update show create_memberships destroy_membershipedit_membership add_users]diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rbindex 2af67cb280a..ffcc23bfe19 100644--- a/app/controllers/help_controller.rb+++ b/app/controllers/help_controller.rb@@ -27,6 +27,8 @@#++class HelpController < ApplicationController+ no_authorization_required! only: %i[keyboard_shortcuts text_formatting]+def keyboard_shortcutsredirect_to OpenProject::Static::Links[:shortcuts][:href]enddiff --git a/app/controllers/highlighting_controller.rb b/app/controllers/highlighting_controller.rbindex 6cd953a7f8f..b67442cd91f 100644--- a/app/controllers/highlighting_controller.rb+++ b/app/controllers/highlighting_controller.rb@@ -29,6 +29,7 @@class HighlightingController < ApplicationControllerbefore_action :determine_freshnessskip_before_action :check_if_login_required, only: [:styles]+ no_authorization_required! only: [:styles]def stylesresponse.content_type = Mime[:css]diff --git a/app/controllers/homescreen_controller.rb b/app/controllers/homescreen_controller.rbindex c84ed013104..a989230b62a 100644--- a/app/controllers/homescreen_controller.rb+++ b/app/controllers/homescreen_controller.rb@@ -28,6 +28,7 @@class HomescreenController < ApplicationControllerskip_before_action :check_if_login_required, only: [:robots]+ no_authorization_required! only: %i[index robots]layout "global"diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rbindex cd408645845..31e664f0e60 100644--- a/app/controllers/journals_controller.rb+++ b/app/controllers/journals_controller.rb@@ -29,9 +29,12 @@#++class JournalsController < ApplicationController- before_action :find_optional_project, only: [:index]- before_action :find_journal, only: [:diff]- before_action :ensure_permitted, only: [:diff]+ before_action :authorize_in_optional_project, only: [:index]+ before_action :find_journal,+ :ensure_permitted,+ only: [:diff]+ authorization_checked! only: %i[diff]+accept_key_auth :indexmenu_item :issuesdiff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rbindex efe9fcb66f3..397afab2373 100644--- a/app/controllers/messages_controller.rb+++ b/app/controllers/messages_controller.rb@@ -32,6 +32,8 @@ class MessagesController < ApplicationControllermodel_object Message, scope: Forumbefore_action :find_object_and_scopebefore_action :authorize, except: %i[edit update destroy]+ # Checked inside the method.+ no_authorization_required! only: %i[edit update destroy]include AttachmentsHelperinclude PaginationHelperdiff --git a/app/controllers/my/auto_login_tokens_controller.rb b/app/controllers/my/auto_login_tokens_controller.rbindex 21de9f6f221..f0222b9f856 100644--- a/app/controllers/my/auto_login_tokens_controller.rb+++ b/app/controllers/my/auto_login_tokens_controller.rb@@ -1,5 +1,8 @@module Myclass AutoLoginTokensController < ::ApplicationController+ before_action :require_login+ no_authorization_required! only: %i(destroy)+before_action :find_token, only: %i(destroy)layout "my"diff --git a/app/controllers/my/sessions_controller.rb b/app/controllers/my/sessions_controller.rbindex b243be219a6..2c6094505d6 100644--- a/app/controllers/my/sessions_controller.rb+++ b/app/controllers/my/sessions_controller.rb@@ -1,6 +1,8 @@module Myclass SessionsController < ::ApplicationControllerbefore_action :require_login+ no_authorization_required! only: %i(index show destroy)+self._model_object = ::Sessions::UserSessionbefore_action :find_model_object, only: %i(show destroy)diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rbindex 52937b948e4..95bd8021132 100644--- a/app/controllers/my_controller.rb+++ b/app/controllers/my_controller.rb@@ -39,6 +39,22 @@ class MyController < ApplicationControllerbefore_action :set_grouped_ical_tokens, only: %i[access_token]before_action :set_ical_token, only: %i[revoke_ical_token]+ no_authorization_required! only: %i[account+ update_account+ settings+ update_settings+ password+ change_password+ access_token+ delete_storage_token+ notifications+ reminders+ generate_rss_key+ revoke_rss_key+ generate_api_key+ revoke_api_key+ revoke_ical_token]+menu_item :account, only: [:account]menu_item :settings, only: [:settings]menu_item :password, only: [:password]@@ -177,6 +193,8 @@ class MyController < ApplicationControllerredirect_to action: 'access_token'end+ private+def default_breadcrumbI18n.t(:label_my_account)end@@ -185,8 +203,6 @@ class MyController < ApplicationControllerfalseend- private-def redirect_if_password_change_not_allowed_for(user)unless user.change_password_allowed?flash[:error] = I18n.t(:notice_can_t_change_password)diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rbindex 92d31cf6c08..3455f2d1324 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 :find_optional_project, only: [:index]+ before_action :authorize_in_optional_project, only: [:index]accept_key_auth :indexdef indexdiff --git a/app/controllers/oauth/auth_base_controller.rb b/app/controllers/oauth/auth_base_controller.rbindex 1428e523019..89a6b5f88fe 100644--- a/app/controllers/oauth/auth_base_controller.rb+++ b/app/controllers/oauth/auth_base_controller.rb@@ -37,6 +37,8 @@ module OAuthprepend_before_action :extend_content_security_policyskip_before_action :check_if_login_required+ no_authorization_required!+layout "only_logo"def extend_content_security_policydiff --git a/app/controllers/oauth/grants_controller.rb b/app/controllers/oauth/grants_controller.rbindex e38afe156b1..c4587b5e5e8 100644--- a/app/controllers/oauth/grants_controller.rb+++ b/app/controllers/oauth/grants_controller.rb@@ -29,6 +29,7 @@module OAuthclass GrantsController < ::ApplicationControllerbefore_action :require_login+ authorization_checked! only: %i[index revoke_application]layout "my"menu_item :access_token@@ -57,6 +58,7 @@ module OAuthdef find_application::Doorkeeper::Application+ .authorized_for(current_user).where(id: params[:application_id]).select(:name, :id).takediff --git a/app/controllers/oauth_clients_controller.rb b/app/controllers/oauth_clients_controller.rbindex 4a9823bc427..afe14e36985 100644--- a/app/controllers/oauth_clients_controller.rb+++ b/app/controllers/oauth_clients_controller.rb@@ -38,6 +38,8 @@ class OAuthClientsController < ApplicationControllerbefore_action :set_code, only: [:callback]before_action :set_connection_manager, only: [:callback]+ no_authorization_required! only: %i[callback ensure_connection]+after_action :clear_oauth_state_cookie, only: [:callback]# Provide the OAuth2 "callback" endpoint.diff --git a/app/controllers/onboarding_controller.rb b/app/controllers/onboarding_controller.rbindex b63925e1b9b..95bc94725a4 100644--- a/app/controllers/onboarding_controller.rb+++ b/app/controllers/onboarding_controller.rb@@ -27,6 +27,8 @@#++class OnboardingController < ApplicationController+ no_authorization_required! only: %i[user_settings]+def user_settings@user = User.currentdiff --git a/app/controllers/placeholder_users_controller.rb b/app/controllers/placeholder_users_controller.rbindex 8ec919515c3..daaf585fce5 100644--- a/app/controllers/placeholder_users_controller.rb+++ b/app/controllers/placeholder_users_controller.rb@@ -30,6 +30,7 @@ class PlaceholderUsersController < ApplicationControllerinclude EnterpriseTrialHelperlayout "admin"before_action :authorize_global, except: %i[show]+ no_authorization_required! only: %i[show]before_action :find_placeholder_user, only: %i[showeditdiff --git a/app/controllers/projects/menus_controller.rb b/app/controllers/projects/menus_controller.rbindex 57edb6124e8..08c92d81fc3 100644--- a/app/controllers/projects/menus_controller.rb+++ b/app/controllers/projects/menus_controller.rb@@ -29,6 +29,7 @@ module Projectsclass MenusController < ApplicationController# No authorize as every user (or logged in user)# is allowed to see the menu.+ no_authorization_required! only: :showdef showprojects_menu = Menus::Projects.new(controller_path: params[:controller_path], params:, current_user:)diff --git a/app/controllers/projects/queries_controller.rb b/app/controllers/projects/queries_controller.rbindex bf9bbc36fd1..27b7018364e 100644--- a/app/controllers/projects/queries_controller.rb+++ b/app/controllers/projects/queries_controller.rb@@ -30,6 +30,7 @@ class Projects::QueriesController < ApplicationControllerinclude Projects::QueryLoading# No need for a more specific authorization check. That is carried out in the contracts.+ no_authorization_required! only: %i[show new create rename update publish unpublish destroy]before_action :require_loginbefore_action :find_query, only: %i[show rename update destroy publish unpublish]before_action :build_query_or_deny_access, only: %i[new create]diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rbindex a23acff93c7..3d09898e072 100644--- a/app/controllers/projects_controller.rb+++ b/app/controllers/projects_controller.rb@@ -36,6 +36,8 @@ class ProjectsController < ApplicationControllerbefore_action :authorize_global, only: %i[new]before_action :require_admin, only: %i[destroy destroy_info]+ no_authorization_required! only: %i[index]+include SortHelperinclude PaginationHelperinclude QueriesHelperdiff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rbindex dbdf68110eb..2b526534d47 100644--- a/app/controllers/search_controller.rb+++ b/app/controllers/search_controller.rb@@ -29,7 +29,7 @@class SearchController < ApplicationControllerinclude Layout- before_action :find_optional_project,+ before_action :authorize_in_optional_project,:prepare_tokensLIMIT = 10diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rbindex 1a599d96d23..9f7ea9ea6ef 100644--- a/app/controllers/users_controller.rb+++ b/app/controllers/users_controller.rb@@ -44,6 +44,9 @@ class UsersController < ApplicationControllerbefore_action :authorize_for_user, only: [:destroy]before_action :check_if_deletion_allowed, only: %i[deletion_infodestroy]+ no_authorization_required! only: %i[show]+ authorization_checked! only: %i[destroy deletion_info]+before_action :set_current_activity_page, only: [:show]# Password confirmation helpers and actionsdiff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rbindex af71ecb1556..9d367af4b51 100644--- a/app/controllers/watchers_controller.rb+++ b/app/controllers/watchers_controller.rb@@ -27,16 +27,15 @@#++class WatchersController < ApplicationController- before_action :find_watched_by_object- before_action :find_project- before_action :require_login, :check_project_privacy, only: %i[watch unwatch]+ before_action :find_watched_by_object,+ :find_project,+ :require_login,+ :deny_access_unless_visible++ authorization_checked! only: %i[watch unwatch]def watch- if @watched.respond_to?(:visible?) && [email protected]?(User.current)- render_403- else- set_watcher(User.current, true)- end+ set_watcher(User.current, true)enddef unwatch@@ -60,4 +59,8 @@ class WatchersController < ApplicationController@watched.set_watcher(user, watching)redirect_back(fallback_location: home_url)end++ def deny_access_unless_visible+ deny_access unless @watched.visible?(User.current)+ endenddiff --git a/app/controllers/work_packages/auto_completes_controller.rb b/app/controllers/work_packages/auto_completes_controller.rbindex 58152a1e5ff..f5533e281c7 100644--- a/app/controllers/work_packages/auto_completes_controller.rb+++ b/app/controllers/work_packages/auto_completes_controller.rb@@ -29,6 +29,9 @@require "rack/utils"class WorkPackages::AutoCompletesController < ApplicationController+ # Authorization is checked by the query.+ no_authorization_required! only: :index+def index@work_packages = work_packages_matching_query_propdiff --git a/app/controllers/work_packages/progress_controller.rb b/app/controllers/work_packages/progress_controller.rbindex d9e5cfa196a..f10dc61cf1e 100644--- a/app/controllers/work_packages/progress_controller.rb+++ b/app/controllers/work_packages/progress_controller.rb@@ -37,6 +37,7 @@ class WorkPackages::ProgressController < ApplicationControllerlayout falsebefore_action :set_work_packagebefore_action :extract_persisted_progress_attributes, only: %i[edit create update]+ authorization_checked! only: %i[new edit create update]helper_method :modal_classdiff --git a/app/controllers/work_packages_controller.rb b/app/controllers/work_packages_controller.rbindex ab209aadfa2..f66dcea7711 100644--- a/app/controllers/work_packages_controller.rb+++ b/app/controllers/work_packages_controller.rb@@ -36,9 +36,10 @@ class WorkPackagesController < ApplicationControllerbefore_action :authorize_on_work_package,:project, only: :show- before_action :find_optional_project,+ before_action :authorize_in_optional_project,:check_allowed_export,:protect_from_unauthorized_export, only: :index+ authorization_checked! only: %i[index show]before_action :load_and_validate_query, only: :index, unless: -> { request.format.html? }before_action :load_work_packages, only: :index, if: -> { request.format.atom? }diff --git a/modules/avatars/app/controllers/avatars/avatar_controller.rb b/modules/avatars/app/controllers/avatars/avatar_controller.rbindex 39dc2c32acf..a5a68b0f74e 100644--- a/modules/avatars/app/controllers/avatars/avatar_controller.rb+++ b/modules/avatars/app/controllers/avatars/avatar_controller.rb@@ -3,6 +3,8 @@ module ::Avatarsbefore_action :ensure_enabledbefore_action :find_avatar+ no_authorization_required!+def showsend_file @avatar.diskfile,filename: filename_for_content_disposition(@avatar.filename),diff --git a/modules/avatars/app/controllers/avatars/my_avatar_controller.rb b/modules/avatars/app/controllers/avatars/my_avatar_controller.rbindex 5acbbdeb17a..9054b3c03a7 100644--- a/modules/avatars/app/controllers/avatars/my_avatar_controller.rb+++ b/modules/avatars/app/controllers/avatars/my_avatar_controller.rb@@ -3,6 +3,8 @@ module ::Avatarsbefore_action :require_loginbefore_action :set_user+ no_authorization_required! only: %i[show update destroy]+layout "my"menu_item :avatardiff --git a/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb b/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rbindex 00c6bdcca40..0e3ac8abe60 100644--- a/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb+++ b/modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb@@ -39,6 +39,7 @@ module Bimbefore_action :authorize, except: %i[direct_upload_finished set_direct_upload_file_name]before_action :require_login, only: [:set_direct_upload_file_name]skip_before_action :verify_authenticity_token, only: [:set_direct_upload_file_name] # AJAX request in page, so skip authenticity token+ no_authorization_required! only: %i[set_direct_upload_file_name direct_upload_finished]menu_item :ifc_modelsdiff --git a/modules/boards/app/controllers/boards/boards_controller.rb b/modules/boards/app/controllers/boards/boards_controller.rbindex 4d60fabb108..07e9f85d6b8 100644--- a/modules/boards/app/controllers/boards/boards_controller.rb+++ b/modules/boards/app/controllers/boards/boards_controller.rb@@ -2,10 +2,7 @@ module ::Boardsclass BoardsController < BaseControllerinclude Layout- before_action :find_optional_project-- before_action :authorize_global, if: -> { @project.nil? }- before_action :authorize, if: -> { @project.present? }+ before_action :authorize_in_optional_project# The boards permission alone does not suffice# to view work packagesdiff --git a/modules/budgets/app/controllers/budgets_controller.rb b/modules/budgets/app/controllers/budgets_controller.rbindex 852a1d5758a..a6edf12954f 100644--- a/modules/budgets/app/controllers/budgets_controller.rb+++ b/modules/budgets/app/controllers/budgets_controller.rb@@ -32,16 +32,17 @@ class BudgetsController < ApplicationControllerbefore_action :find_budget, only: %i[show edit update copy destroy_info]before_action :find_budgets, only: :destroybefore_action :check_and_update_belonging_work_packages, only: :destroy- before_action :find_project, only: %i[new create update_material_budget_item update_labor_budget_item]+ before_action :find_project_by_project_id, only: %i[new create update_material_budget_item update_labor_budget_item]before_action :find_optional_project, only: :indexbefore_action :authorize_global, only: :indexbefore_action :authorize, except: [- # unrestricted actions:index,+ # unrestricted actions:update_material_budget_item,:update_labor_budget_item]+ no_authorization_required! only: %i[update_material_budget_item update_labor_budget_item]helper :sortinclude SortHelperdiff --git a/modules/calendar/app/controllers/calendar/calendars_controller.rb b/modules/calendar/app/controllers/calendar/calendars_controller.rbindex c85bd8311c6..2145a5b76e8 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 :find_optional_project+ before_action :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/calendar/app/controllers/calendar/ical_controller.rb b/modules/calendar/app/controllers/calendar/ical_controller.rbindex f3284d7c4f5..ad2deaffad1 100644--- a/modules/calendar/app/controllers/calendar/ical_controller.rb+++ b/modules/calendar/app/controllers/calendar/ical_controller.rb@@ -30,6 +30,7 @@ module ::Calendarclass ICalController < ApplicationController# Authentication and authorization is handled within the service.skip_before_action :check_if_login_required+ no_authorization_required! only: :showdef showbegindiff --git a/modules/costs/app/controllers/hourly_rates_controller.rb b/modules/costs/app/controllers/hourly_rates_controller.rbindex f97c18a8f02..b47f0cf22e6 100644--- a/modules/costs/app/controllers/hourly_rates_controller.rb+++ b/modules/costs/app/controllers/hourly_rates_controller.rb@@ -38,8 +38,9 @@ class HourlyRatesController < ApplicationControllerbefore_action :find_optional_project, only: %i[show edit update]before_action :find_project, only: [:set_rate]- # #show, #edit have their own authorization+ # #show, #edit and #update have their own authorizationbefore_action :authorize, except: %i[show edit update]+ no_authorization_required! only: %i[show edit update]# TODO: this should be an indexdef showdiff --git a/modules/gantt/app/controllers/gantt/gantt_controller.rb b/modules/gantt/app/controllers/gantt/gantt_controller.rbindex 62424595cb7..69289d26747 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 :find_optional_project, :protect_from_unauthorized_export, only: :index+ before_action :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 094e0148151..3e6cae9bdd8 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 :find_optional_project+ before_action :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 41588cf11dd..07b9a2dbc7a 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 :find_optional_project, only: %i[index new show create history]+ before_action :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/recaptcha/app/controllers/recaptcha/request_controller.rb b/modules/recaptcha/app/controllers/recaptcha/request_controller.rbindex 2d48aa38032..63f81b212f1 100644--- a/modules/recaptcha/app/controllers/recaptcha/request_controller.rb+++ b/modules/recaptcha/app/controllers/recaptcha/request_controller.rb@@ -7,6 +7,7 @@ module ::Recaptcha# User is not yet logged in, so skip login required checkskip_before_action :check_if_login_required+ no_authorization_required! only: %i[perform verify]# Skip if recaptcha was disabledbefore_action :skip_if_disableddiff --git a/modules/reporting/app/controllers/cost_reports_controller.rb b/modules/reporting/app/controllers/cost_reports_controller.rbindex 8014ac1b6e5..d333cf6430f 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 :find_optional_project+ before_action :authorize_in_optional_projectbefore_action :find_optional_userinclude Layoutdiff --git a/modules/storages/app/controllers/storages/project_storages_controller.rb b/modules/storages/app/controllers/storages/project_storages_controller.rbindex 8a63558450d..530e79b8f18 100644--- a/modules/storages/app/controllers/storages/project_storages_controller.rb+++ b/modules/storages/app/controllers/storages/project_storages_controller.rb@@ -36,6 +36,7 @@ class Storages::ProjectStoragesController < ApplicationControllerbefore_action :find_model_objectbefore_action :find_project_by_project_idbefore_action :render_403, unless: -> { User.current.allowed_in_project?(:view_file_links, @project) }+ no_authorization_required! only: %i[open]# rubocop:disable Metrics/AbcSizedef opendiff --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 aecacbec217..c720fd2ba2a 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,10 +2,8 @@ module ::TeamPlannerclass TeamPlannerController < BaseControllerinclude EnterpriseTrialHelperinclude Layout- before_action :find_optional_project+ before_action :authorize_in_optional_projectbefore_action :build_plan_view, only: %i[new]- before_action :authorize, except: %i[overview new create upsale]- before_action :authorize_global, only: %i[overview new create]before_action :require_ee_token, except: %i[upsale]before_action :find_plan_view, only: %i[destroy]diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rbindex a16a2a07060..fdd4dc400c7 100644--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb@@ -11,6 +11,7 @@ module ::TwoFactorAuthentication# User is not yet logged in, so skip login required checkskip_before_action :check_if_login_required+ no_authorization_required!# Avoid catch-all from core resulting in methodsbefore_action :only_post, only: :confirm_otpdiff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller.rbindex 384d95fec42..0a5f2363cae 100644--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller.rb+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller.rb@@ -6,6 +6,12 @@ module ::TwoFactorAuthentication# Skip default loginskip_before_action :check_if_login_required+ no_authorization_required! only: %i[register+ new+ confirm+ web_authn+ make_default+ destroy]before_action :find_device, only: [:confirm]diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/backup_codes_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/backup_codes_controller.rbindex 9ed10ef1d1e..a6eb12a0f84 100644--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/backup_codes_controller.rb+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/backup_codes_controller.rb@@ -3,6 +3,7 @@ module ::TwoFactorAuthenticationclass BackupCodesController < ::ApplicationController# Ensure user is logged inbefore_action :require_login+ no_authorization_required! only: %i[show create]# Password confirmation helpers and actionsinclude PasswordConfirmation@@ -23,6 +24,8 @@ module ::TwoFactorAuthenticationrenderend+ private+def check_regenerate_done@backup_codes = flash[:_backup_codes]flash.delete :_backup_codesdiff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/remember_cookie_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/remember_cookie_controller.rbindex 3f9d0d52055..5be5a66ee3a 100644--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/remember_cookie_controller.rb+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/remember_cookie_controller.rb@@ -6,6 +6,7 @@ module ::TwoFactorAuthentication# Ensure user is logged inbefore_action :require_login+ no_authorization_required!layout "my"menu_item :two_factor_authenticationdiff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rbindex d8d2844cbf0..59f69f24c15 100644--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rb+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rb@@ -3,8 +3,10 @@ module ::TwoFactorAuthenticationclass TwoFactorDevicesController < ::TwoFactorAuthentication::BaseController# Ensure user is logged inbefore_action :require_login-before_action :set_user_variables+ # Authorization is not handled explictly but as the user on which changes can be done is only the current user+ # (and that user needs to be logged in), no action harmful to other users can be done.+ no_authorization_required!before_action :find_device, except: %i[new index register webauthn_challenge]diff --git a/modules/webhooks/app/controllers/webhooks/incoming/hooks_controller.rb b/modules/webhooks/app/controllers/webhooks/incoming/hooks_controller.rbindex 208399b7d3f..f1ef5786a89 100644--- a/modules/webhooks/app/controllers/webhooks/incoming/hooks_controller.rb+++ b/modules/webhooks/app/controllers/webhooks/incoming/hooks_controller.rb@@ -35,6 +35,9 @@ module Webhooks# Disable CSRF detection since we openly welcome POSTs here!skip_before_action :verify_authenticity_token+ # Authorization cannot be applied since authentication is skipped.+ # It is then to be ensured when handling the hook.+ no_authorization_required! only: [:handle_hook]# Wrap the JSON body as 'payload' param# making it available as params[:payload]diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rbindex 1445e4aa56d..0d39fe54a3f 100644--- a/spec/controllers/application_controller_spec.rb+++ b/spec/controllers/application_controller_spec.rb@@ -33,6 +33,8 @@ RSpec.describe ApplicationController do# Fake controller to test calling an actioncontroller do+ no_authorization_required!+def index# just do anything that doesn't require an extra templateredirect_to root_path@@ -152,6 +154,8 @@ RSpec.describe ApplicationController docontroller doinclude OpenProjectErrorHelper+ no_authorization_required!+def indexop_handle_error "fail"