GitLab steht wegen Wartungsarbeiten am Montag, den 10. Mai, zwischen 17:00 und 19:00 Uhr nicht zur Verfügung.

Commit 39f9af8a authored by jplang's avatar jplang

Use .before_action instead of .before_filter.

git-svn-id: https://svn.redmine.org/redmine/trunk@15655 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent f9c87101
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
class ActivitiesController < ApplicationController class ActivitiesController < ApplicationController
menu_item :activity menu_item :activity
before_filter :find_optional_project before_action :find_optional_project
accept_rss_auth :index accept_rss_auth :index
def index def index
......
...@@ -21,7 +21,7 @@ class AdminController < ApplicationController ...@@ -21,7 +21,7 @@ class AdminController < ApplicationController
menu_item :plugins, :only => :plugins menu_item :plugins, :only => :plugins
menu_item :info, :only => :info menu_item :info, :only => :info
before_filter :require_admin before_action :require_admin
helper :sort helper :sort
include SortHelper include SortHelper
......
...@@ -51,7 +51,7 @@ class ApplicationController < ActionController::Base ...@@ -51,7 +51,7 @@ class ApplicationController < ActionController::Base
end end
end end
before_filter :session_expiration, :user_setup, :check_if_login_required, :check_password_change, :set_localization before_action :session_expiration, :user_setup, :check_if_login_required, :check_password_change, :set_localization
rescue_from ::Unauthorized, :with => :deny_access rescue_from ::Unauthorized, :with => :deny_access
rescue_from ::ActionView::MissingTemplate, :with => :missing_template rescue_from ::ActionView::MissingTemplate, :with => :missing_template
...@@ -369,7 +369,7 @@ class ApplicationController < ActionController::Base ...@@ -369,7 +369,7 @@ class ApplicationController < ActionController::Base
end end
# make sure that the user is a member of the project (or admin) if project is private # make sure that the user is a member of the project (or admin) if project is private
# used as a before_filter for actions that do not require any particular permission on the project # used as a before_action for actions that do not require any particular permission on the project
def check_project_privacy def check_project_privacy
if @project && !@project.archived? if @project && !@project.archived?
if @project.visible? if @project.visible?
......
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class AttachmentsController < ApplicationController class AttachmentsController < ApplicationController
before_filter :find_attachment, :only => [:show, :download, :thumbnail, :destroy] before_action :find_attachment, :only => [:show, :download, :thumbnail, :destroy]
before_filter :find_editable_attachments, :only => [:edit, :update] before_action :find_editable_attachments, :only => [:edit, :update]
before_filter :file_readable, :read_authorize, :only => [:show, :download, :thumbnail] before_action :file_readable, :read_authorize, :only => [:show, :download, :thumbnail]
before_filter :delete_authorize, :only => :destroy before_action :delete_authorize, :only => :destroy
before_filter :authorize_global, :only => :upload before_action :authorize_global, :only => :upload
accept_api_auth :show, :download, :thumbnail, :upload, :destroy accept_api_auth :show, :download, :thumbnail, :upload, :destroy
......
...@@ -19,8 +19,8 @@ class AuthSourcesController < ApplicationController ...@@ -19,8 +19,8 @@ class AuthSourcesController < ApplicationController
layout 'admin' layout 'admin'
menu_item :ldap_authentication menu_item :ldap_authentication
before_filter :require_admin before_action :require_admin
before_filter :find_auth_source, :only => [:edit, :update, :test_connection, :destroy] before_action :find_auth_source, :only => [:edit, :update, :test_connection, :destroy]
require_sudo_mode :update, :destroy require_sudo_mode :update, :destroy
def index def index
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class AutoCompletesController < ApplicationController class AutoCompletesController < ApplicationController
before_filter :find_project before_action :find_project
def issues def issues
@issues = [] @issues = []
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
class BoardsController < ApplicationController class BoardsController < ApplicationController
default_search_scope :messages default_search_scope :messages
before_filter :find_project_by_project_id, :find_board_if_available, :authorize before_action :find_project_by_project_id, :find_board_if_available, :authorize
accept_rss_auth :index, :show accept_rss_auth :index, :show
helper :sort helper :sort
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
class CalendarsController < ApplicationController class CalendarsController < ApplicationController
menu_item :calendar menu_item :calendar
before_filter :find_optional_project before_action :find_optional_project
rescue_from Query::StatementInvalid, :with => :query_statement_invalid rescue_from Query::StatementInvalid, :with => :query_statement_invalid
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
class CommentsController < ApplicationController class CommentsController < ApplicationController
default_search_scope :news default_search_scope :news
model_object News model_object News
before_filter :find_model_object before_action :find_model_object
before_filter :find_project_from_association before_action :find_project_from_association
before_filter :authorize before_action :authorize
def create def create
raise Unauthorized unless @news.commentable? raise Unauthorized unless @news.commentable?
......
...@@ -19,7 +19,7 @@ class ContextMenusController < ApplicationController ...@@ -19,7 +19,7 @@ class ContextMenusController < ApplicationController
helper :watchers helper :watchers
helper :issues helper :issues
before_filter :find_issues, :only => :issues before_action :find_issues, :only => :issues
def issues def issues
if (@issues.size == 1) if (@issues.size == 1)
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
class CustomFieldEnumerationsController < ApplicationController class CustomFieldEnumerationsController < ApplicationController
layout 'admin' layout 'admin'
before_filter :require_admin before_action :require_admin
before_filter :find_custom_field before_action :find_custom_field
before_filter :find_enumeration, :only => :destroy before_action :find_enumeration, :only => :destroy
helper :custom_fields helper :custom_fields
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
class CustomFieldsController < ApplicationController class CustomFieldsController < ApplicationController
layout 'admin' layout 'admin'
before_filter :require_admin before_action :require_admin
before_filter :build_new_custom_field, :only => [:new, :create] before_action :build_new_custom_field, :only => [:new, :create]
before_filter :find_custom_field, :only => [:edit, :update, :destroy] before_action :find_custom_field, :only => [:edit, :update, :destroy]
accept_api_auth :index accept_api_auth :index
def index def index
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
class DocumentsController < ApplicationController class DocumentsController < ApplicationController
default_search_scope :documents default_search_scope :documents
model_object Document model_object Document
before_filter :find_project_by_project_id, :only => [:index, :new, :create] before_action :find_project_by_project_id, :only => [:index, :new, :create]
before_filter :find_model_object, :except => [:index, :new, :create] before_action :find_model_object, :except => [:index, :new, :create]
before_filter :find_project_from_association, :except => [:index, :new, :create] before_action :find_project_from_association, :except => [:index, :new, :create]
before_filter :authorize before_action :authorize
helper :attachments helper :attachments
helper :custom_fields helper :custom_fields
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class EmailAddressesController < ApplicationController class EmailAddressesController < ApplicationController
before_filter :find_user, :require_admin_or_current_user before_action :find_user, :require_admin_or_current_user
before_filter :find_email_address, :only => [:update, :destroy] before_action :find_email_address, :only => [:update, :destroy]
require_sudo_mode :create, :update, :destroy require_sudo_mode :create, :update, :destroy
def index def index
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
class EnumerationsController < ApplicationController class EnumerationsController < ApplicationController
layout 'admin' layout 'admin'
before_filter :require_admin, :except => :index before_action :require_admin, :except => :index
before_filter :require_admin_or_api_request, :only => :index before_action :require_admin_or_api_request, :only => :index
before_filter :build_new_enumeration, :only => [:new, :create] before_action :build_new_enumeration, :only => [:new, :create]
before_filter :find_enumeration, :only => [:edit, :update, :destroy] before_action :find_enumeration, :only => [:edit, :update, :destroy]
accept_api_auth :index accept_api_auth :index
helper :custom_fields helper :custom_fields
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
class FilesController < ApplicationController class FilesController < ApplicationController
menu_item :files menu_item :files
before_filter :find_project_by_project_id before_action :find_project_by_project_id
before_filter :authorize before_action :authorize
helper :sort helper :sort
include SortHelper include SortHelper
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
class GanttsController < ApplicationController class GanttsController < ApplicationController
menu_item :gantt menu_item :gantt
before_filter :find_optional_project before_action :find_optional_project
rescue_from Query::StatementInvalid, :with => :query_statement_invalid rescue_from Query::StatementInvalid, :with => :query_statement_invalid
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
class GroupsController < ApplicationController class GroupsController < ApplicationController
layout 'admin' layout 'admin'
before_filter :require_admin before_action :require_admin
before_filter :find_group, :except => [:index, :new, :create] before_action :find_group, :except => [:index, :new, :create]
accept_api_auth :index, :show, :create, :update, :destroy, :add_users, :remove_user accept_api_auth :index, :show, :create, :update, :destroy, :add_users, :remove_user
require_sudo_mode :add_users, :remove_user, :create, :update, :destroy, :edit_membership, :destroy_membership require_sudo_mode :add_users, :remove_user, :create, :update, :destroy, :edit_membership, :destroy_membership
......
...@@ -19,8 +19,8 @@ require 'csv' ...@@ -19,8 +19,8 @@ require 'csv'
class ImportsController < ApplicationController class ImportsController < ApplicationController
before_filter :find_import, :only => [:show, :settings, :mapping, :run] before_action :find_import, :only => [:show, :settings, :mapping, :run]
before_filter :authorize_global before_action :authorize_global
helper :issues helper :issues
helper :queries helper :queries
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
class IssueCategoriesController < ApplicationController class IssueCategoriesController < ApplicationController
menu_item :settings menu_item :settings
model_object IssueCategory model_object IssueCategory
before_filter :find_model_object, :except => [:index, :new, :create] before_action :find_model_object, :except => [:index, :new, :create]
before_filter :find_project_from_association, :except => [:index, :new, :create] before_action :find_project_from_association, :except => [:index, :new, :create]
before_filter :find_project_by_project_id, :only => [:index, :new, :create] before_action :find_project_by_project_id, :only => [:index, :new, :create]
before_filter :authorize before_action :authorize
accept_api_auth :index, :show, :create, :update, :destroy accept_api_auth :index, :show, :create, :update, :destroy
def index def index
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class IssueRelationsController < ApplicationController class IssueRelationsController < ApplicationController
before_filter :find_issue, :authorize, :only => [:index, :create] before_action :find_issue, :authorize, :only => [:index, :create]
before_filter :find_relation, :only => [:show, :destroy] before_action :find_relation, :only => [:show, :destroy]
accept_api_auth :index, :show, :create, :destroy accept_api_auth :index, :show, :create, :destroy
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
class IssueStatusesController < ApplicationController class IssueStatusesController < ApplicationController
layout 'admin' layout 'admin'
before_filter :require_admin, :except => :index before_action :require_admin, :except => :index
before_filter :require_admin_or_api_request, :only => :index before_action :require_admin_or_api_request, :only => :index
accept_api_auth :index accept_api_auth :index
def index def index
......
...@@ -18,11 +18,11 @@ ...@@ -18,11 +18,11 @@
class IssuesController < ApplicationController class IssuesController < ApplicationController
default_search_scope :issues default_search_scope :issues
before_filter :find_issue, :only => [:show, :edit, :update] before_action :find_issue, :only => [:show, :edit, :update]
before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :destroy] before_action :find_issues, :only => [:bulk_edit, :bulk_update, :destroy]
before_filter :authorize, :except => [:index, :new, :create] before_action :authorize, :except => [:index, :new, :create]
before_filter :find_optional_project, :only => [:index, :new, :create] before_action :find_optional_project, :only => [:index, :new, :create]
before_filter :build_new_issue_from_params, :only => [:new, :create] before_action :build_new_issue_from_params, :only => [:new, :create]
accept_rss_auth :index, :show accept_rss_auth :index, :show
accept_api_auth :index, :show, :create, :update, :destroy accept_api_auth :index, :show, :create, :update, :destroy
......
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class JournalsController < ApplicationController class JournalsController < ApplicationController
before_filter :find_journal, :only => [:edit, :update, :diff] before_action :find_journal, :only => [:edit, :update, :diff]
before_filter :find_issue, :only => [:new] before_action :find_issue, :only => [:new]
before_filter :find_optional_project, :only => [:index] before_action :find_optional_project, :only => [:index]
before_filter :authorize, :only => [:new, :edit, :update, :diff] before_action :authorize, :only => [:new, :edit, :update, :diff]
accept_rss_auth :index accept_rss_auth :index
menu_item :issues menu_item :issues
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class MailHandlerController < ActionController::Base class MailHandlerController < ActionController::Base
before_filter :check_credential before_action :check_credential
# Displays the email submission form # Displays the email submission form
def new def new
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
class MembersController < ApplicationController class MembersController < ApplicationController
model_object Member model_object Member
before_filter :find_model_object, :except => [:index, :new, :create, :autocomplete] before_action :find_model_object, :except => [:index, :new, :create, :autocomplete]
before_filter :find_project_from_association, :except => [:index, :new, :create, :autocomplete] before_action :find_project_from_association, :except => [:index, :new, :create, :autocomplete]
before_filter :find_project_by_project_id, :only => [:index, :new, :create, :autocomplete] before_action :find_project_by_project_id, :only => [:index, :new, :create, :autocomplete]
before_filter :authorize before_action :authorize
accept_api_auth :index, :show, :create, :update, :destroy accept_api_auth :index, :show, :create, :update, :destroy
require_sudo_mode :create, :update, :destroy require_sudo_mode :create, :update, :destroy
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
class MessagesController < ApplicationController class MessagesController < ApplicationController
menu_item :boards menu_item :boards
default_search_scope :messages default_search_scope :messages
before_filter :find_board, :only => [:new, :preview] before_action :find_board, :only => [:new, :preview]
before_filter :find_attachments, :only => [:preview] before_action :find_attachments, :only => [:preview]
before_filter :find_message, :except => [:new, :preview] before_action :find_message, :except => [:new, :preview]
before_filter :authorize, :except => [:preview, :edit, :destroy] before_action :authorize, :except => [:preview, :edit, :destroy]
helper :boards helper :boards
helper :watchers helper :watchers
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class MyController < ApplicationController class MyController < ApplicationController
before_filter :require_login before_action :require_login
# let user change user's password when user has to # let user change user's password when user has to
skip_before_filter :check_password_change, :only => :password skip_before_filter :check_password_change, :only => :password
......
...@@ -18,11 +18,11 @@ ...@@ -18,11 +18,11 @@
class NewsController < ApplicationController class NewsController < ApplicationController
default_search_scope :news default_search_scope :news
model_object News model_object News
before_filter :find_model_object, :except => [:new, :create, :index] before_action :find_model_object, :except => [:new, :create, :index]
before_filter :find_project_from_association, :except => [:new, :create, :index] before_action :find_project_from_association, :except => [:new, :create, :index]
before_filter :find_project_by_project_id, :only => [:new, :create] before_action :find_project_by_project_id, :only => [:new, :create]
before_filter :authorize, :except => [:index] before_action :authorize, :except => [:index]
before_filter :find_optional_project, :only => :index before_action :find_optional_project, :only => :index
accept_rss_auth :index accept_rss_auth :index
accept_api_auth :index accept_api_auth :index
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class PreviewsController < ApplicationController class PreviewsController < ApplicationController
before_filter :find_project, :find_attachments before_action :find_project, :find_attachments
def issue def issue
@issue = Issue.visible.find_by_id(params[:id]) unless params[:id].blank? @issue = Issue.visible.find_by_id(params[:id]) unless params[:id].blank?
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
class PrincipalMembershipsController < ApplicationController class PrincipalMembershipsController < ApplicationController
layout 'admin' layout 'admin'
before_filter :require_admin before_action :require_admin
before_filter :find_principal, :only => [:new, :create] before_action :find_principal, :only => [:new, :create]
before_filter :find_membership, :only => [:update, :destroy] before_action :find_membership, :only => [:update, :destroy]
def new def new
@projects = Project.active.all @projects = Project.active.all
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class ProjectEnumerationsController < ApplicationController class ProjectEnumerationsController < ApplicationController
before_filter :find_project_by_project_id before_action :find_project_by_project_id
before_filter :authorize before_action :authorize
def update def update
if params[:enumerations] if params[:enumerations]
......
...@@ -19,10 +19,10 @@ class ProjectsController < ApplicationController ...@@ -19,10 +19,10 @@ class ProjectsController < ApplicationController
menu_item :overview menu_item :overview
menu_item :settings, :only => :settings menu_item :settings, :only => :settings
before_filter :find_project, :except => [ :index, :list, :new, :create, :copy ] before_action :find_project, :except => [ :index, :list, :new, :create, :copy ]
before_filter :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy] before_action :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy]
before_filter :authorize_global, :only => [:new, :create] before_action :authorize_global, :only => [:new, :create]
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ] before_action :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ]