diff --git a/app/controllers/advisories_controller.rb b/app/controllers/advisories_controller.rb index 3e2388636..fff0df8a5 100644 --- a/app/controllers/advisories_controller.rb +++ b/app/controllers/advisories_controller.rb @@ -1,6 +1,6 @@ class AdvisoriesController < ApplicationController - before_filter :authenticate_user! - skip_before_filter :authenticate_user! if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user! if APP_CONFIG['anonymous_access'] load_resource find_by: :advisory_id authorize_resource diff --git a/app/controllers/api/v1/advisories_controller.rb b/app/controllers/api/v1/advisories_controller.rb index 0d555dbf6..6688036ab 100644 --- a/app/controllers/api/v1/advisories_controller.rb +++ b/app/controllers/api/v1/advisories_controller.rb @@ -1,8 +1,8 @@ class Api::V1::AdvisoriesController < Api::V1::BaseController - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] load_resource :advisory, find_by: :advisory_id - before_filter :find_and_authorize_build_list, only: [:create, :update] + before_action :find_and_authorize_build_list, only: [:create, :update] authorize_resource :build_list, only: [:create, :update] def index diff --git a/app/controllers/api/v1/arches_controller.rb b/app/controllers/api/v1/arches_controller.rb index 28bc61caf..3968bad77 100644 --- a/app/controllers/api/v1/arches_controller.rb +++ b/app/controllers/api/v1/arches_controller.rb @@ -1,5 +1,5 @@ class Api::V1::ArchesController < Api::V1::BaseController - before_filter :authenticate_user! unless APP_CONFIG['anonymous_access'] + before_action :authenticate_user! unless APP_CONFIG['anonymous_access'] def index @arches = Arch.order(:id).paginate(paginate_params) diff --git a/app/controllers/api/v1/build_lists_controller.rb b/app/controllers/api/v1/build_lists_controller.rb index a87a7c717..8d1a1a67c 100644 --- a/app/controllers/api/v1/build_lists_controller.rb +++ b/app/controllers/api/v1/build_lists_controller.rb @@ -1,6 +1,6 @@ class Api::V1::BuildListsController < Api::V1::BaseController - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:show, :index] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:show, :index] if APP_CONFIG['anonymous_access'] load_and_authorize_resource :build_list, only: [:show, :create, :cancel, :publish, :reject_publish, :create_container, :publish_into_testing, :rerun_tests] diff --git a/app/controllers/api/v1/groups_controller.rb b/app/controllers/api/v1/groups_controller.rb index 076b485d4..4ca344a1b 100644 --- a/app/controllers/api/v1/groups_controller.rb +++ b/app/controllers/api/v1/groups_controller.rb @@ -1,7 +1,7 @@ class Api::V1::GroupsController < Api::V1::BaseController - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:show] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:show] if APP_CONFIG['anonymous_access'] load_and_authorize_resource def index diff --git a/app/controllers/api/v1/issues_controller.rb b/app/controllers/api/v1/issues_controller.rb index fa90360b2..55d612e90 100644 --- a/app/controllers/api/v1/issues_controller.rb +++ b/app/controllers/api/v1/issues_controller.rb @@ -1,6 +1,6 @@ class Api::V1::IssuesController < Api::V1::BaseController - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:index, :group_index, :show] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:index, :group_index, :show] if APP_CONFIG['anonymous_access'] load_and_authorize_resource :group, only: :group_index, find_by: :id, parent: false load_and_authorize_resource :project diff --git a/app/controllers/api/v1/jobs_controller.rb b/app/controllers/api/v1/jobs_controller.rb index bbb663609..915c19c18 100644 --- a/app/controllers/api/v1/jobs_controller.rb +++ b/app/controllers/api/v1/jobs_controller.rb @@ -4,7 +4,7 @@ class Api::V1::JobsController < Api::V1::BaseController QUEUES = %w(rpm_worker_observer) QUEUE_CLASSES = %w(AbfWorker::RpmWorkerObserver) - before_filter :authenticate_user! + before_action :authenticate_user! def shift @build_list = BuildList.next_build(arch_ids, platform_ids) if current_user.system? diff --git a/app/controllers/api/v1/maintainers_controller.rb b/app/controllers/api/v1/maintainers_controller.rb index 13170768e..a5045dbb8 100644 --- a/app/controllers/api/v1/maintainers_controller.rb +++ b/app/controllers/api/v1/maintainers_controller.rb @@ -1,5 +1,5 @@ class Api::V1::MaintainersController < Api::V1::BaseController - before_filter :authenticate_user! unless APP_CONFIG['anonymous_access'] + before_action :authenticate_user! unless APP_CONFIG['anonymous_access'] load_and_authorize_resource :platform def index diff --git a/app/controllers/api/v1/platforms_controller.rb b/app/controllers/api/v1/platforms_controller.rb index 6b070a1e2..1aeea6556 100644 --- a/app/controllers/api/v1/platforms_controller.rb +++ b/app/controllers/api/v1/platforms_controller.rb @@ -1,7 +1,7 @@ class Api::V1::PlatformsController < Api::V1::BaseController - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: :allowed - skip_before_filter :authenticate_user!, only: [:show, :platforms_for_build, :members] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: :allowed + skip_before_action :authenticate_user!, only: [:show, :platforms_for_build, :members] if APP_CONFIG['anonymous_access'] load_and_authorize_resource except: :allowed def allowed diff --git a/app/controllers/api/v1/product_build_lists_controller.rb b/app/controllers/api/v1/product_build_lists_controller.rb index b581a43e0..b05e06fe2 100644 --- a/app/controllers/api/v1/product_build_lists_controller.rb +++ b/app/controllers/api/v1/product_build_lists_controller.rb @@ -1,6 +1,6 @@ class Api::V1::ProductBuildListsController < Api::V1::BaseController - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] load_and_authorize_resource :product, only: :index load_and_authorize_resource diff --git a/app/controllers/api/v1/products_controller.rb b/app/controllers/api/v1/products_controller.rb index 605781c73..3e51a3dbf 100644 --- a/app/controllers/api/v1/products_controller.rb +++ b/app/controllers/api/v1/products_controller.rb @@ -1,6 +1,6 @@ class Api::V1::ProductsController < Api::V1::BaseController - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] load_and_authorize_resource diff --git a/app/controllers/api/v1/projects_controller.rb b/app/controllers/api/v1/projects_controller.rb index 205dfea96..541121b9d 100644 --- a/app/controllers/api/v1/projects_controller.rb +++ b/app/controllers/api/v1/projects_controller.rb @@ -1,7 +1,7 @@ class Api::V1::ProjectsController < Api::V1::BaseController - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:get_id, :show, :refs_list] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:get_id, :show, :refs_list] if APP_CONFIG['anonymous_access'] load_and_authorize_resource :project diff --git a/app/controllers/api/v1/pull_requests_controller.rb b/app/controllers/api/v1/pull_requests_controller.rb index a67ff04a3..1e68b6234 100644 --- a/app/controllers/api/v1/pull_requests_controller.rb +++ b/app/controllers/api/v1/pull_requests_controller.rb @@ -1,8 +1,8 @@ class Api::V1::PullRequestsController < Api::V1::BaseController respond_to :json - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:show, :index, :group_index, :commits, :files] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:show, :index, :group_index, :commits, :files] if APP_CONFIG['anonymous_access'] load_resource :group, only: :group_index, find_by: :id, parent: false load_resource :project diff --git a/app/controllers/api/v1/repositories_controller.rb b/app/controllers/api/v1/repositories_controller.rb index 353cdb447..389b958d9 100644 --- a/app/controllers/api/v1/repositories_controller.rb +++ b/app/controllers/api/v1/repositories_controller.rb @@ -1,8 +1,8 @@ class Api::V1::RepositoriesController < Api::V1::BaseController respond_to :csv, only: :packages - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:show, :projects] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:show, :projects] if APP_CONFIG['anonymous_access'] load_and_authorize_resource :repository, through: :platform, shallow: true diff --git a/app/controllers/api/v1/search_controller.rb b/app/controllers/api/v1/search_controller.rb index ad9a1bfc3..ff27a2f24 100644 --- a/app/controllers/api/v1/search_controller.rb +++ b/app/controllers/api/v1/search_controller.rb @@ -1,5 +1,5 @@ class Api::V1::SearchController < Api::V1::BaseController - before_filter :authenticate_user! unless APP_CONFIG['anonymous_access'] + before_action :authenticate_user! unless APP_CONFIG['anonymous_access'] def index search = Search.new(params[:query], current_ability, paginate_params) diff --git a/app/controllers/api/v1/users_controller.rb b/app/controllers/api/v1/users_controller.rb index 12cd893a5..6dee2793b 100644 --- a/app/controllers/api/v1/users_controller.rb +++ b/app/controllers/api/v1/users_controller.rb @@ -1,9 +1,9 @@ class Api::V1::UsersController < Api::V1::BaseController - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:show] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:show] if APP_CONFIG['anonymous_access'] load_and_authorize_resource :user, only: :show - before_filter :set_current_user, except: :show + before_action :set_current_user, except: :show def show @user = User.opened.find params[:id] # dont show system users diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6b1be9d89..6b1e0570e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -9,12 +9,12 @@ class ApplicationController < ActionController::Base layout :layout_by_resource # Hack to prevent token auth on all pages except atom feed: - prepend_before_filter -> { redirect_to(new_user_session_path) if params[:token] && params[:token].is_a?(String) && params[:format] != 'atom'} + prepend_before_action -> { redirect_to(new_user_session_path) if params[:token] && params[:token].is_a?(String) && params[:format] != 'atom'} - before_filter :set_locale - before_filter -> { EventLog.current_controller = self }, + before_action :set_locale + before_action -> { EventLog.current_controller = self }, only: [:create, :destroy, :open_id, :cancel, :publish, :change_visibility] # :update - after_filter -> { EventLog.current_controller = nil } + after_action -> { EventLog.current_controller = nil } helper_method :get_owner diff --git a/app/controllers/autocompletes_controller.rb b/app/controllers/autocompletes_controller.rb index 2cebbc752..e6ec9bbc9 100644 --- a/app/controllers/autocompletes_controller.rb +++ b/app/controllers/autocompletes_controller.rb @@ -1,5 +1,5 @@ class AutocompletesController < ApplicationController - before_filter :authenticate_user! + before_action :authenticate_user! def autocomplete_user_uname results = User.opened.search(params[:query]).search_order.limit(5) diff --git a/app/controllers/groups/base_controller.rb b/app/controllers/groups/base_controller.rb index 7428bfbe4..8ae7d9344 100644 --- a/app/controllers/groups/base_controller.rb +++ b/app/controllers/groups/base_controller.rb @@ -1,6 +1,6 @@ class Groups::BaseController < ApplicationController - before_filter :authenticate_user! - before_filter :find_group + before_action :authenticate_user! + before_action :find_group protected diff --git a/app/controllers/groups/members_controller.rb b/app/controllers/groups/members_controller.rb index 01492a1e9..e70119a9c 100644 --- a/app/controllers/groups/members_controller.rb +++ b/app/controllers/groups/members_controller.rb @@ -1,5 +1,5 @@ class Groups::MembersController < Groups::BaseController - before_filter -> { authorize! :manage_members, @group } + before_action -> { authorize! :manage_members, @group } def index @members = @group.members.order(:uname) - [@group.owner] diff --git a/app/controllers/groups/profile_controller.rb b/app/controllers/groups/profile_controller.rb index 549bd1fe1..5c5d7b40b 100644 --- a/app/controllers/groups/profile_controller.rb +++ b/app/controllers/groups/profile_controller.rb @@ -3,7 +3,7 @@ class Groups::ProfileController < Groups::BaseController include PaginateHelper load_and_authorize_resource class: Group, instance_name: 'group' - skip_before_filter :authenticate_user!, only: :show if APP_CONFIG['anonymous_access'] + skip_before_action :authenticate_user!, only: :show if APP_CONFIG['anonymous_access'] def index @groups = current_user.groups.paginate(page: params[:group_page]) # accessible_by(current_ability) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 39495990d..8f7450022 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,5 +1,5 @@ class HomeController < ApplicationController - before_filter :authenticate_user!, only: [:activity, :issues, :pull_requests] + before_action :authenticate_user!, only: [:activity, :issues, :pull_requests] def root render 'pages/tour/abf-tour-project-description-1' diff --git a/app/controllers/platforms/contents_controller.rb b/app/controllers/platforms/contents_controller.rb index 183a06f27..ee4a8e796 100644 --- a/app/controllers/platforms/contents_controller.rb +++ b/app/controllers/platforms/contents_controller.rb @@ -1,8 +1,8 @@ class Platforms::ContentsController < Platforms::BaseController include PaginateHelper - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: :index if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: :index if APP_CONFIG['anonymous_access'] load_and_authorize_resource :platform diff --git a/app/controllers/platforms/key_pairs_controller.rb b/app/controllers/platforms/key_pairs_controller.rb index f381f6e14..22522e6f0 100644 --- a/app/controllers/platforms/key_pairs_controller.rb +++ b/app/controllers/platforms/key_pairs_controller.rb @@ -1,5 +1,5 @@ class Platforms::KeyPairsController < Platforms::BaseController - before_filter :authenticate_user! + before_action :authenticate_user! load_and_authorize_resource :platform load_and_authorize_resource only: [:create, :destroy] diff --git a/app/controllers/platforms/maintainers_controller.rb b/app/controllers/platforms/maintainers_controller.rb index 8a3af467c..ba6f70eb6 100644 --- a/app/controllers/platforms/maintainers_controller.rb +++ b/app/controllers/platforms/maintainers_controller.rb @@ -1,6 +1,6 @@ class Platforms::MaintainersController < ApplicationController - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:index] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:index] if APP_CONFIG['anonymous_access'] load_and_authorize_resource :platform def index diff --git a/app/controllers/platforms/mass_builds_controller.rb b/app/controllers/platforms/mass_builds_controller.rb index b09330b09..70daee366 100644 --- a/app/controllers/platforms/mass_builds_controller.rb +++ b/app/controllers/platforms/mass_builds_controller.rb @@ -1,8 +1,8 @@ class Platforms::MassBuildsController < Platforms::BaseController include DatatableHelper - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:index, :get_list] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:index, :get_list] if APP_CONFIG['anonymous_access'] load_resource :platform load_and_authorize_resource :through => :platform, :shallow => true diff --git a/app/controllers/platforms/platforms_controller.rb b/app/controllers/platforms/platforms_controller.rb index 9ff1a2060..8762c11c2 100644 --- a/app/controllers/platforms/platforms_controller.rb +++ b/app/controllers/platforms/platforms_controller.rb @@ -1,8 +1,8 @@ class Platforms::PlatformsController < Platforms::BaseController include FileStoreHelper - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:advisories, :members, :show] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:advisories, :members, :show] if APP_CONFIG['anonymous_access'] load_and_authorize_resource def index diff --git a/app/controllers/platforms/product_build_lists_controller.rb b/app/controllers/platforms/product_build_lists_controller.rb index 1198f674e..61a0241f0 100644 --- a/app/controllers/platforms/product_build_lists_controller.rb +++ b/app/controllers/platforms/product_build_lists_controller.rb @@ -1,9 +1,9 @@ class Platforms::ProductBuildListsController < Platforms::BaseController include FileStoreHelper - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:index, :show, :log] if APP_CONFIG['anonymous_access'] - before_filter :redirect_to_full_path_if_short_url, only: [:show, :update] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:index, :show, :log] if APP_CONFIG['anonymous_access'] + before_action :redirect_to_full_path_if_short_url, only: [:show, :update] load_and_authorize_resource :platform, except: :index load_and_authorize_resource :product, through: :platform, except: :index load_and_authorize_resource :product_build_list, through: :product, except: :index diff --git a/app/controllers/platforms/products_controller.rb b/app/controllers/platforms/products_controller.rb index e42b7a8c7..42eec8516 100644 --- a/app/controllers/platforms/products_controller.rb +++ b/app/controllers/platforms/products_controller.rb @@ -1,8 +1,8 @@ class Platforms::ProductsController < Platforms::BaseController include GitHelper - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] load_and_authorize_resource :platform load_and_authorize_resource :product, through: :platform, except: :autocomplete_project diff --git a/app/controllers/platforms/repositories_controller.rb b/app/controllers/platforms/repositories_controller.rb index 3691b3308..d0a820b3e 100644 --- a/app/controllers/platforms/repositories_controller.rb +++ b/app/controllers/platforms/repositories_controller.rb @@ -4,12 +4,12 @@ class Platforms::RepositoriesController < Platforms::BaseController include RepositoriesHelper include PaginateHelper - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:index, :show, :projects_list] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:index, :show, :projects_list] if APP_CONFIG['anonymous_access'] load_and_authorize_resource :platform load_and_authorize_resource :repository, through: :platform, shallow: true - before_filter :set_members, only: [:edit, :update] + before_action :set_members, only: [:edit, :update] def index @repositories = Repository.custom_sort(@repositories).paginate(page: current_page) diff --git a/app/controllers/platforms/tokens_controller.rb b/app/controllers/platforms/tokens_controller.rb index 636f626a3..49a58a722 100644 --- a/app/controllers/platforms/tokens_controller.rb +++ b/app/controllers/platforms/tokens_controller.rb @@ -1,5 +1,5 @@ class Platforms::TokensController < Platforms::BaseController - before_filter :authenticate_user! + before_action :authenticate_user! load_resource :platform load_and_authorize_resource :through => :platform, :shallow => true diff --git a/app/controllers/projects/base_controller.rb b/app/controllers/projects/base_controller.rb index 9157a8a10..626823400 100644 --- a/app/controllers/projects/base_controller.rb +++ b/app/controllers/projects/base_controller.rb @@ -1,6 +1,6 @@ class Projects::BaseController < ApplicationController - prepend_before_filter :find_project - before_filter :init_statistics + prepend_before_action :find_project + before_action :init_statistics protected diff --git a/app/controllers/projects/build_lists_controller.rb b/app/controllers/projects/build_lists_controller.rb index fae8c0822..983ef4d14 100644 --- a/app/controllers/projects/build_lists_controller.rb +++ b/app/controllers/projects/build_lists_controller.rb @@ -4,17 +4,17 @@ class Projects::BuildListsController < Projects::BaseController NESTED_ACTIONS = [:index, :new, :create] - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:show, :index, :log] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:show, :index, :log] if APP_CONFIG['anonymous_access'] - before_filter :find_build_list, only: [:show, :publish, :cancel, :update, :log, :create_container, :dependent_projects] + before_action :find_build_list, only: [:show, :publish, :cancel, :update, :log, :create_container, :dependent_projects] load_and_authorize_resource :project, only: [:new, :create] load_resource :project, only: :index, parent: false load_and_authorize_resource :build_list, through: :project, only: NESTED_ACTIONS, shallow: true load_and_authorize_resource except: NESTED_ACTIONS - before_filter :create_from_build_list, only: :new + before_action :create_from_build_list, only: :new def index authorize!(:show, @project) if @project diff --git a/app/controllers/projects/collaborators_controller.rb b/app/controllers/projects/collaborators_controller.rb index 5edae3e4d..be9a89c1f 100644 --- a/app/controllers/projects/collaborators_controller.rb +++ b/app/controllers/projects/collaborators_controller.rb @@ -1,12 +1,12 @@ class Projects::CollaboratorsController < Projects::BaseController respond_to :html, :json - before_filter :authenticate_user! + before_action :authenticate_user! load_resource :project - before_filter :authorize_collaborators + before_action :authorize_collaborators - before_filter :find_users - before_filter :find_groups + before_action :find_users + before_action :find_groups def index @collaborators = Collaborator.find_by_project(@project) diff --git a/app/controllers/projects/comments_controller.rb b/app/controllers/projects/comments_controller.rb index d4c1dc767..851ddf7d9 100644 --- a/app/controllers/projects/comments_controller.rb +++ b/app/controllers/projects/comments_controller.rb @@ -1,8 +1,8 @@ class Projects::CommentsController < Projects::BaseController - before_filter :authenticate_user! + before_action :authenticate_user! load_and_authorize_resource :project - before_filter :find_commentable - before_filter :find_or_build_comment + before_action :find_commentable + before_action :find_or_build_comment load_and_authorize_resource new: :new_line include CommentsHelper diff --git a/app/controllers/projects/commit_subscribes_controller.rb b/app/controllers/projects/commit_subscribes_controller.rb index 55e4fabce..28d61ac5c 100644 --- a/app/controllers/projects/commit_subscribes_controller.rb +++ b/app/controllers/projects/commit_subscribes_controller.rb @@ -1,8 +1,8 @@ class Projects::CommitSubscribesController < Projects::BaseController - before_filter :authenticate_user! + before_action :authenticate_user! load_and_authorize_resource :project - before_filter :find_commit + before_action :find_commit def create if Subscribe.subscribe_to_commit(@options) diff --git a/app/controllers/projects/git/base_controller.rb b/app/controllers/projects/git/base_controller.rb index 203c746ed..a52145470 100644 --- a/app/controllers/projects/git/base_controller.rb +++ b/app/controllers/projects/git/base_controller.rb @@ -1,13 +1,13 @@ class Projects::Git::BaseController < Projects::BaseController - before_filter :authenticate_user! + before_action :authenticate_user! if APP_CONFIG['anonymous_access'] - skip_before_filter :authenticate_user!, only: %i(show index blame raw archive diff tags branches) - before_filter :authenticate_user, only: %i(show index blame raw archive diff tags branches) + skip_before_action :authenticate_user!, only: %i(show index blame raw archive diff tags branches) + before_action :authenticate_user, only: %i(show index blame raw archive diff tags branches) end load_and_authorize_resource :project - before_filter :set_treeish_and_path - before_filter :set_branch_and_tree + before_action :set_treeish_and_path + before_action :set_branch_and_tree protected diff --git a/app/controllers/projects/git/blobs_controller.rb b/app/controllers/projects/git/blobs_controller.rb index a8c6c16f1..76d199b88 100644 --- a/app/controllers/projects/git/blobs_controller.rb +++ b/app/controllers/projects/git/blobs_controller.rb @@ -1,6 +1,6 @@ class Projects::Git::BlobsController < Projects::Git::BaseController - before_filter :set_blob - before_filter -> {authorize! :write, @project}, only: [:edit, :update] + before_action :set_blob + before_action -> {authorize! :write, @project}, only: [:edit, :update] def show end diff --git a/app/controllers/projects/hooks_controller.rb b/app/controllers/projects/hooks_controller.rb index 1192a4b7e..d580e7c08 100644 --- a/app/controllers/projects/hooks_controller.rb +++ b/app/controllers/projects/hooks_controller.rb @@ -1,5 +1,5 @@ class Projects::HooksController < Projects::BaseController - before_filter :authenticate_user! + before_action :authenticate_user! load_and_authorize_resource :project load_and_authorize_resource :hook, through: :project diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index d8b00d7b8..6c4df4003 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -1,11 +1,11 @@ class Projects::IssuesController < Projects::BaseController NON_RESTFUL_ACTION = [:create_label, :update_label, :destroy_label] - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] load_resource :project load_and_authorize_resource :issue, through: :project, find_by: :serial_id, only: [:show, :edit, :update, :destroy, :new, :create, :index] - before_filter :load_and_authorize_label, only: NON_RESTFUL_ACTION - before_filter :find_collaborators, only: [:new, :create, :show, :search_collaborators] + before_action :load_and_authorize_label, only: NON_RESTFUL_ACTION + before_action :find_collaborators, only: [:new, :create, :show, :search_collaborators] layout false, only: [:update, :search_collaborators] diff --git a/app/controllers/projects/projects_controller.rb b/app/controllers/projects/projects_controller.rb index 7f220d307..35801df81 100644 --- a/app/controllers/projects/projects_controller.rb +++ b/app/controllers/projects/projects_controller.rb @@ -2,9 +2,9 @@ class Projects::ProjectsController < Projects::BaseController include DatatableHelper include ProjectsHelper - before_filter :authenticate_user! + before_action :authenticate_user! load_and_authorize_resource id_param: :name_with_owner # to force member actions load - before_filter :who_owns, only: [:new, :create, :mass_import, :run_mass_import] + before_action :who_owns, only: [:new, :create, :mass_import, :run_mass_import] def index @projects = Project.accessible_by(current_ability, :membered).search(params[:search]) diff --git a/app/controllers/projects/pull_requests_controller.rb b/app/controllers/projects/pull_requests_controller.rb index 9f1c865c0..dd71e5ddc 100644 --- a/app/controllers/projects/pull_requests_controller.rb +++ b/app/controllers/projects/pull_requests_controller.rb @@ -1,11 +1,11 @@ class Projects::PullRequestsController < Projects::BaseController - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:index, :show] if APP_CONFIG['anonymous_access'] load_and_authorize_resource :project load_resource :issue, through: :project, find_by: :serial_id, parent: false, except: [:index, :autocomplete_to_project] load_and_authorize_resource instance_name: :pull, through: :issue, singleton: true, except: [:index, :autocomplete_to_project] - before_filter :find_collaborators, only: [:new, :create, :show] + before_action :find_collaborators, only: [:new, :create, :show] def new to_project = find_destination_project(false) diff --git a/app/controllers/projects/subscribes_controller.rb b/app/controllers/projects/subscribes_controller.rb index 992af9d0f..ac66411a3 100644 --- a/app/controllers/projects/subscribes_controller.rb +++ b/app/controllers/projects/subscribes_controller.rb @@ -1,5 +1,5 @@ class Projects::SubscribesController < Projects::BaseController - before_filter :authenticate_user! + before_action :authenticate_user! load_and_authorize_resource :project load_and_authorize_resource :issue, through: :project, find_by: :serial_id diff --git a/app/controllers/projects/wiki_controller.rb b/app/controllers/projects/wiki_controller.rb index bf8e462a6..3a6c08cc3 100644 --- a/app/controllers/projects/wiki_controller.rb +++ b/app/controllers/projects/wiki_controller.rb @@ -4,13 +4,13 @@ require 'cgi' class Projects::WikiController < Projects::BaseController WIKI_OPTIONS = {} - before_filter :authenticate_user! - skip_before_filter :authenticate_user!, only: [:show, :index, :git, :compare, :compare_wiki, :history, :wiki_history, :search, :pages] if APP_CONFIG['anonymous_access'] + before_action :authenticate_user! + skip_before_action :authenticate_user!, only: [:show, :index, :git, :compare, :compare_wiki, :history, :wiki_history, :search, :pages] if APP_CONFIG['anonymous_access'] load_resource :project - before_filter :authorize_read_actions, only: [:index, :show, :git, :compare, :compare_wiki, :history, :wiki_history, :search, :pages] - before_filter :authorize_write_actions, only: [:edit, :update, :new, :create, :destroy, :revert, :revert_wiki, :preview] - before_filter :get_wiki + before_action :authorize_read_actions, only: [:index, :show, :git, :compare, :compare_wiki, :history, :wiki_history, :search, :pages] + before_action :authorize_write_actions, only: [:edit, :update, :new, :create, :destroy, :revert, :revert_wiki, :preview] + before_action :get_wiki def index @name = 'Home' diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 12b452097..2291cddb6 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -1,7 +1,7 @@ class SearchController < ApplicationController include PaginateHelper - before_filter :authenticate_user! unless APP_CONFIG['anonymous_access'] + before_action :authenticate_user! unless APP_CONFIG['anonymous_access'] # load_and_authorize_resource def index diff --git a/app/controllers/users/base_controller.rb b/app/controllers/users/base_controller.rb index 1a8e47d92..c195b7706 100644 --- a/app/controllers/users/base_controller.rb +++ b/app/controllers/users/base_controller.rb @@ -1,6 +1,6 @@ class Users::BaseController < ApplicationController - before_filter :authenticate_user! - before_filter :find_user + before_action :authenticate_user! + before_action :find_user protected diff --git a/app/controllers/users/profile_controller.rb b/app/controllers/users/profile_controller.rb index c2a68afa1..c3470371b 100644 --- a/app/controllers/users/profile_controller.rb +++ b/app/controllers/users/profile_controller.rb @@ -1,7 +1,7 @@ class Users::ProfileController < Users::BaseController include PaginateHelper - skip_before_filter :authenticate_user!, only: :show if APP_CONFIG['anonymous_access'] + skip_before_action :authenticate_user!, only: :show if APP_CONFIG['anonymous_access'] def show respond_to do |format| diff --git a/app/controllers/users/register_requests_controller.rb b/app/controllers/users/register_requests_controller.rb index ee79d8940..bbe23a47b 100644 --- a/app/controllers/users/register_requests_controller.rb +++ b/app/controllers/users/register_requests_controller.rb @@ -1,5 +1,5 @@ class Users::RegisterRequestsController < ApplicationController - before_filter :user_choose_locale + before_action :user_choose_locale layout 'invite' def new diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 551232059..8bdf6807f 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,5 +1,5 @@ class Users::RegistrationsController < Devise::RegistrationsController - before_filter :update_sanitized_params, if: :devise_controller? + before_action :update_sanitized_params, if: :devise_controller? # POST /resource def create diff --git a/app/controllers/users/settings_controller.rb b/app/controllers/users/settings_controller.rb index 7a2724dfb..155bb64be 100644 --- a/app/controllers/users/settings_controller.rb +++ b/app/controllers/users/settings_controller.rb @@ -1,7 +1,7 @@ class Users::SettingsController < Users::BaseController include AvatarHelper - before_filter :set_current_user + before_action :set_current_user def profile if request.patch? diff --git a/app/controllers/users/ssh_keys_controller.rb b/app/controllers/users/ssh_keys_controller.rb index e5a4ec887..64c7575de 100644 --- a/app/controllers/users/ssh_keys_controller.rb +++ b/app/controllers/users/ssh_keys_controller.rb @@ -1,5 +1,5 @@ class Users::SshKeysController < Users::BaseController - before_filter :set_current_user + before_action :set_current_user def index @ssh_key = SshKey.new diff --git a/app/controllers/users/users_controller.rb b/app/controllers/users/users_controller.rb index f3aeaefc0..dd5b0c0e1 100644 --- a/app/controllers/users/users_controller.rb +++ b/app/controllers/users/users_controller.rb @@ -1,6 +1,6 @@ class Users::UsersController < Users::BaseController - skip_before_filter :authenticate_user!, only: [:allowed, :check, :discover] - before_filter :find_user_by_key, only: [:allowed, :discover] + skip_before_action :authenticate_user!, only: [:allowed, :check, :discover] + before_action :find_user_by_key, only: [:allowed, :discover] def allowed project = Project.find_by_owner_and_name! params[:project]