Commit be1be2c4 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'move-controller-prepends' into 'master'

Move EE prepend/include to the end of controllers

See merge request gitlab-org/gitlab-ee!8201
parents 71cf8df0 d12d9834
# frozen_string_literal: true
class Admin::AppearancesController < Admin::ApplicationController
prepend EE::Admin::AppearancesController
before_action :set_appearance, except: :create
def show
......@@ -79,3 +77,5 @@ class Admin::AppearancesController < Admin::ApplicationController
]
end
end
Admin::AppearancesController.prepend(EE::Admin::AppearancesController)
......@@ -2,8 +2,6 @@
class Admin::ApplicationSettingsController < Admin::ApplicationController
include InternalRedirect
prepend EE::Admin::ApplicationSettingsController
before_action :set_application_setting
def show
......@@ -135,3 +133,5 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
]
end
end
Admin::ApplicationSettingsController.prepend(EE::Admin::ApplicationSettingsController)
......@@ -3,8 +3,6 @@
class Admin::GroupsController < Admin::ApplicationController
include MembersPresentation
prepend EE::Admin::GroupsController
before_action :group, only: [:edit, :update, :destroy, :project_update, :members_update]
def index
......@@ -95,3 +93,5 @@ class Admin::GroupsController < Admin::ApplicationController
]
end
end
Admin::GroupsController.prepend(EE::Admin::GroupsController)
# frozen_string_literal: true
class Admin::LogsController < Admin::ApplicationController
prepend EE::Admin::LogsController
before_action :loggers
def show
......@@ -21,3 +19,5 @@ class Admin::LogsController < Admin::ApplicationController
]
end
end
Admin::LogsController.prepend(EE::Admin::LogsController)
# frozen_string_literal: true
class Admin::UsersController < Admin::ApplicationController
prepend EE::Admin::UsersController
before_action :user, except: [:index, :new, :create]
def index
......@@ -230,3 +228,5 @@ class Admin::UsersController < Admin::ApplicationController
result[:status] == :success
end
end
Admin::UsersController.prepend(EE::Admin::UsersController)
# frozen_string_literal: true
class AutocompleteController < ApplicationController
prepend EE::AutocompleteController
skip_before_action :authenticate_user!, only: [:users, :award_emojis]
def users
......@@ -41,3 +39,5 @@ class AutocompleteController < ApplicationController
render json: AwardedEmojiFinder.new(current_user).execute
end
end
AutocompleteController.prepend(EE::AutocompleteController)
# frozen_string_literal: true
module InternalRedirect
prepend EE::InternalRedirect
extend ActiveSupport::Concern
def safe_redirect_path(path)
......@@ -46,3 +45,5 @@ module InternalRedirect
URI(request.referer).path
end
end
InternalRedirect.prepend(EE::InternalRedirect)
# frozen_string_literal: true
module IssuableActions
prepend EE::IssuableActions
extend ActiveSupport::Concern
include Gitlab::Utils::StrongMemoize
......@@ -227,3 +226,5 @@ module IssuableActions
@project || @group # rubocop:disable Gitlab/ModuleWithInstanceVariables
end
end
IssuableActions.prepend(EE::IssuableActions)
# frozen_string_literal: true
module IssuableCollections
prepend EE::IssuableCollections
extend ActiveSupport::Concern
include CookiesHelper
include SortingHelper
......@@ -179,3 +178,5 @@ module IssuableCollections
end
end
end
IssuableCollections.prepend(EE::IssuableCollections)
......@@ -15,7 +15,6 @@ module LfsRequest
CONTENT_TYPE = 'application/vnd.git-lfs+json'.freeze
included do
prepend EE::LfsRequest
before_action :require_lfs_enabled!
before_action :lfs_check_access!
end
......@@ -124,3 +123,5 @@ module LfsRequest
(authentication_abilities || []).include?(capability)
end
end
LfsRequest.prepend(EE::LfsRequest)
# frozen_string_literal: true
module ProjectUnauthorized
prepend EE::ProjectUnauthorized
extend ActiveSupport::Concern
# EE would override this
......@@ -10,3 +8,5 @@ module ProjectUnauthorized
# no-op
end
end
ProjectUnauthorized.prepend(EE::ProjectUnauthorized)
......@@ -2,8 +2,6 @@
module ServiceParams
extend ActiveSupport::Concern
prepend EE::ServiceParams
ALLOWED_PARAMS_CE = [
:active,
:add_pusher,
......@@ -86,3 +84,5 @@ module ServiceParams
ALLOWED_PARAMS_CE
end
end
ServiceParams.prepend(EE::ServiceParams)
# frozen_string_literal: true
class Groups::ApplicationController < ApplicationController
prepend EE::Groups::ApplicationController
include RoutableActions
include ControllerWithCrossProjectAccessCheck
......@@ -39,3 +38,5 @@ class Groups::ApplicationController < ApplicationController
url_for(safe_params)
end
end
Groups::ApplicationController.prepend(EE::Groups::ApplicationController)
# frozen_string_literal: true
class Groups::BoardsController < Groups::ApplicationController
prepend EE::Boards::BoardsController
include BoardsResponses
before_action :assign_endpoint_vars
......@@ -51,3 +50,5 @@ class Groups::BoardsController < Groups::ApplicationController
end
end
end
Groups::BoardsController.prepend(EE::Boards::BoardsController)
# frozen_string_literal: true
class Groups::GroupMembersController < Groups::ApplicationController
prepend EE::Groups::GroupMembersController
include MembershipActions
include MembersPresentation
include SortingHelper
......@@ -45,3 +43,5 @@ class Groups::GroupMembersController < Groups::ApplicationController
# MembershipActions concern
alias_method :membershipable, :group
end
Groups::GroupMembersController.prepend(EE::Groups::GroupMembersController)
# frozen_string_literal: true
class Groups::MilestonesController < Groups::ApplicationController
prepend EE::Groups::MilestonesController
include MilestoneActions
before_action :group_projects
......@@ -115,3 +113,5 @@ class Groups::MilestonesController < Groups::ApplicationController
params.permit(:state).merge(group_ids: group.id)
end
end
Groups::MilestonesController.prepend(EE::Groups::MilestonesController)
......@@ -6,8 +6,6 @@ class GroupsController < Groups::ApplicationController
include MergeRequestsAction
include ParamsBackwardCompatibility
include PreviewMarkdown
prepend EE::GroupsController
respond_to :html
before_action :authenticate_user!, only: [:new, :create]
......@@ -199,3 +197,5 @@ class GroupsController < Groups::ApplicationController
url_for(safe_params)
end
end
GroupsController.prepend(EE::GroupsController)
......@@ -2,8 +2,6 @@
class Ldap::OmniauthCallbacksController < OmniauthCallbacksController
extend ::Gitlab::Utils::Override
prepend EE::OmniauthCallbacksController
prepend EE::Ldap::OmniauthCallbacksController
def self.define_providers!
return unless Gitlab::Auth::LDAP::Config.enabled?
......@@ -33,3 +31,6 @@ class Ldap::OmniauthCallbacksController < OmniauthCallbacksController
redirect_to new_user_session_path
end
end
Ldap::OmniauthCallbacksController.prepend(EE::OmniauthCallbacksController)
Ldap::OmniauthCallbacksController.prepend(EE::Ldap::OmniauthCallbacksController)
......@@ -3,8 +3,6 @@
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
include AuthenticatesWithTwoFactor
include Devise::Controllers::Rememberable
prepend EE::OmniauthCallbacksController
protect_from_forgery except: [:kerberos, :saml, :cas3], prepend: true
def handle_omniauth
......@@ -201,3 +199,5 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
(request_params['remember_me'] == '1') if request_params.present?
end
end
OmniauthCallbacksController.prepend(EE::OmniauthCallbacksController)
......@@ -7,8 +7,6 @@ class PasswordsController < Devise::PasswordsController
before_action :check_password_authentication_available, only: [:create]
before_action :throttle_reset, only: [:create]
prepend EE::PasswordsController
# rubocop: disable CodeReuse/ActiveRecord
def edit
super
......@@ -66,3 +64,5 @@ class PasswordsController < Devise::PasswordsController
notice: I18n.t('devise.passwords.send_paranoid_instructions')
end
end
PasswordsController.prepend(EE::PasswordsController)
# frozen_string_literal: true
class Projects::BoardsController < Projects::ApplicationController
prepend EE::Boards::BoardsController
include BoardsResponses
include IssuableCollections
......@@ -59,3 +58,5 @@ class Projects::BoardsController < Projects::ApplicationController
end
end
end
Projects::BoardsController.prepend(EE::Boards::BoardsController)
# frozen_string_literal: true
class Projects::ClustersController < Clusters::ClustersController
prepend EE::Projects::ClustersController
include ProjectUnauthorized
prepend_before_action :project
......@@ -24,3 +22,5 @@ class Projects::ClustersController < Clusters::ClustersController
@repository ||= project.repository
end
end
Projects::ClustersController.prepend(EE::Projects::ClustersController)
......@@ -3,8 +3,6 @@
class Projects::MirrorsController < Projects::ApplicationController
include RepositorySettingsRedirect
prepend EE::Projects::MirrorsController
# Authorize
before_action :remote_mirror, only: [:update]
before_action :check_mirror_available!
......@@ -87,3 +85,5 @@ class Projects::MirrorsController < Projects::ApplicationController
params.require(:project).permit(mirror_params_attributes)
end
end
Projects::MirrorsController.prepend(EE::Projects::MirrorsController)
......@@ -3,8 +3,6 @@
module Projects
module Prometheus
class MetricsController < Projects::ApplicationController
prepend EE::Projects::Prometheus::MetricsController
before_action :authorize_admin_project!
before_action :require_prometheus_metrics!
......@@ -34,3 +32,5 @@ module Projects
end
end
end
Projects::Prometheus::MetricsController.prepend(EE::Projects::Prometheus::MetricsController)
......@@ -3,8 +3,6 @@
module Projects
module Settings
class IntegrationsController < Projects::ApplicationController
prepend EE::Projects::Settings::IntegrationsController
include ServiceParams
before_action :authorize_admin_project!
......@@ -27,3 +25,5 @@ module Projects
end
end
end
Projects::Settings::IntegrationsController.prepend(EE::Projects::Settings::IntegrationsController)
......@@ -6,8 +6,6 @@ class ProjectsController < Projects::ApplicationController
include ExtractsPath
include PreviewMarkdown
include SendFileUpload
prepend EE::ProjectsController
before_action :whitelist_query_limiting, only: [:create]
before_action :authenticate_user!, except: [:index, :show, :activity, :refs]
before_action :redirect_git_extension, only: [:show]
......@@ -449,3 +447,5 @@ class ProjectsController < Projects::ApplicationController
@project = @project.present(current_user: current_user)
end
end
ProjectsController.prepend(EE::ProjectsController)
......@@ -4,8 +4,6 @@ class RegistrationsController < Devise::RegistrationsController
include Recaptcha::Verify
include AcceptsPendingInvitations
prepend EE::RegistrationsController
before_action :whitelist_query_limiting, only: [:destroy]
before_action :ensure_terms_accepted,
if: -> { Gitlab::CurrentSettings.current_application_settings.enforce_terms? },
......@@ -121,3 +119,5 @@ class RegistrationsController < Devise::RegistrationsController
Gitlab::Utils.to_boolean(params[:terms_opt_in])
end
end
RegistrationsController.prepend(EE::RegistrationsController)
......@@ -9,8 +9,6 @@
# For users who haven't customized the setting, we simply delegate to
# `DashboardController#show`, which is the default.
class RootController < Dashboard::ProjectsController
prepend EE::RootController
skip_before_action :authenticate_user!, only: [:index]
before_action :redirect_unlogged_user, if: -> { current_user.nil? }
......@@ -64,3 +62,5 @@ class RootController < Dashboard::ProjectsController
root_urls.exclude?(home_page_url)
end
end
RootController.prepend(EE::RootController)
# frozen_string_literal: true
class SentNotificationsController < ApplicationController
prepend EE::SentNotificationsController
skip_before_action :authenticate_user!
def unsubscribe
......@@ -38,3 +36,5 @@ class SentNotificationsController < ApplicationController
end
end
end
SentNotificationsController.prepend(EE::SentNotificationsController)
......@@ -6,8 +6,6 @@ class SessionsController < Devise::SessionsController
include Devise::Controllers::Rememberable
include Recaptcha::ClientHelper
include Recaptcha::Verify
prepend EE::SessionsController
skip_before_action :check_two_factor_requirement, only: [:destroy]
prepend_before_action :check_initial_setup, only: [:new]
......@@ -220,3 +218,5 @@ class SessionsController < Devise::SessionsController
end
end
end
SessionsController.prepend(EE::SessionsController)
......@@ -4,8 +4,6 @@ class UsersController < ApplicationController
include RoutableActions
include RendersMemberAccess
include ControllerWithCrossProjectAccessCheck
prepend EE::UsersController
requires_cross_project_access show: false,
groups: false,
projects: false,
......@@ -165,3 +163,5 @@ class UsersController < ApplicationController
access_denied! unless can?(current_user, :read_user_profile, user)
end
end
UsersController.prepend(EE::UsersController)
......@@ -13,6 +13,10 @@ module EE
end
prepended do
# This before_action needs to be redefined so we can use the new values
# from `admin_not_required_endpoints`.
before_action :authorize_admin_group_member!, except: admin_not_required_endpoints
before_action :authorize_update_group_member!, only: [:update, :override]
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment