class ActivitiesController < ApplicationController
menu_item :activity
- before_filter :find_optional_project
+ before_action :find_optional_project
accept_rss_auth :index
def index
menu_item :plugins, :only => :plugins
menu_item :info, :only => :info
- before_filter :require_admin
+ before_action :require_admin
helper :sort
include SortHelper
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 ::ActionView::MissingTemplate, :with => :missing_template
end
# 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
if @project && !@project.archived?
if @project.visible?
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class AttachmentsController < ApplicationController
- before_filter :find_attachment, :only => [:show, :download, :thumbnail, :destroy]
- before_filter :find_editable_attachments, :only => [:edit, :update]
- before_filter :file_readable, :read_authorize, :only => [:show, :download, :thumbnail]
- before_filter :delete_authorize, :only => :destroy
- before_filter :authorize_global, :only => :upload
+ before_action :find_attachment, :only => [:show, :download, :thumbnail, :destroy]
+ before_action :find_editable_attachments, :only => [:edit, :update]
+ before_action :file_readable, :read_authorize, :only => [:show, :download, :thumbnail]
+ before_action :delete_authorize, :only => :destroy
+ before_action :authorize_global, :only => :upload
accept_api_auth :show, :download, :thumbnail, :upload, :destroy
layout 'admin'
menu_item :ldap_authentication
- before_filter :require_admin
- before_filter :find_auth_source, :only => [:edit, :update, :test_connection, :destroy]
+ before_action :require_admin
+ before_action :find_auth_source, :only => [:edit, :update, :test_connection, :destroy]
require_sudo_mode :update, :destroy
def index
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class AutoCompletesController < ApplicationController
- before_filter :find_project
+ before_action :find_project
def issues
@issues = []
class BoardsController < ApplicationController
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
helper :sort
class CalendarsController < ApplicationController
menu_item :calendar
- before_filter :find_optional_project
+ before_action :find_optional_project
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
class CommentsController < ApplicationController
default_search_scope :news
model_object News
- before_filter :find_model_object
- before_filter :find_project_from_association
- before_filter :authorize
+ before_action :find_model_object
+ before_action :find_project_from_association
+ before_action :authorize
def create
raise Unauthorized unless @news.commentable?
helper :watchers
helper :issues
- before_filter :find_issues, :only => :issues
+ before_action :find_issues, :only => :issues
def issues
if (@issues.size == 1)
class CustomFieldEnumerationsController < ApplicationController
layout 'admin'
- before_filter :require_admin
- before_filter :find_custom_field
- before_filter :find_enumeration, :only => :destroy
+ before_action :require_admin
+ before_action :find_custom_field
+ before_action :find_enumeration, :only => :destroy
helper :custom_fields
class CustomFieldsController < ApplicationController
layout 'admin'
- before_filter :require_admin
- before_filter :build_new_custom_field, :only => [:new, :create]
- before_filter :find_custom_field, :only => [:edit, :update, :destroy]
+ before_action :require_admin
+ before_action :build_new_custom_field, :only => [:new, :create]
+ before_action :find_custom_field, :only => [:edit, :update, :destroy]
accept_api_auth :index
def index
class DocumentsController < ApplicationController
default_search_scope :documents
model_object Document
- before_filter :find_project_by_project_id, :only => [:index, :new, :create]
- before_filter :find_model_object, :except => [:index, :new, :create]
- before_filter :find_project_from_association, :except => [:index, :new, :create]
- before_filter :authorize
+ before_action :find_project_by_project_id, :only => [:index, :new, :create]
+ before_action :find_model_object, :except => [:index, :new, :create]
+ before_action :find_project_from_association, :except => [:index, :new, :create]
+ before_action :authorize
helper :attachments
helper :custom_fields
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class EmailAddressesController < ApplicationController
- before_filter :find_user, :require_admin_or_current_user
- before_filter :find_email_address, :only => [:update, :destroy]
+ before_action :find_user, :require_admin_or_current_user
+ before_action :find_email_address, :only => [:update, :destroy]
require_sudo_mode :create, :update, :destroy
def index
class EnumerationsController < ApplicationController
layout 'admin'
- before_filter :require_admin, :except => :index
- before_filter :require_admin_or_api_request, :only => :index
- before_filter :build_new_enumeration, :only => [:new, :create]
- before_filter :find_enumeration, :only => [:edit, :update, :destroy]
+ before_action :require_admin, :except => :index
+ before_action :require_admin_or_api_request, :only => :index
+ before_action :build_new_enumeration, :only => [:new, :create]
+ before_action :find_enumeration, :only => [:edit, :update, :destroy]
accept_api_auth :index
helper :custom_fields
class FilesController < ApplicationController
menu_item :files
- before_filter :find_project_by_project_id
- before_filter :authorize
+ before_action :find_project_by_project_id
+ before_action :authorize
helper :sort
include SortHelper
class GanttsController < ApplicationController
menu_item :gantt
- before_filter :find_optional_project
+ before_action :find_optional_project
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
class GroupsController < ApplicationController
layout 'admin'
- before_filter :require_admin
- before_filter :find_group, :except => [:index, :new, :create]
+ before_action :require_admin
+ before_action :find_group, :except => [:index, :new, :create]
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
class ImportsController < ApplicationController
- before_filter :find_import, :only => [:show, :settings, :mapping, :run]
- before_filter :authorize_global
+ before_action :find_import, :only => [:show, :settings, :mapping, :run]
+ before_action :authorize_global
helper :issues
helper :queries
class IssueCategoriesController < ApplicationController
menu_item :settings
model_object IssueCategory
- before_filter :find_model_object, :except => [:index, :new, :create]
- before_filter :find_project_from_association, :except => [:index, :new, :create]
- before_filter :find_project_by_project_id, :only => [:index, :new, :create]
- before_filter :authorize
+ before_action :find_model_object, :except => [:index, :new, :create]
+ before_action :find_project_from_association, :except => [:index, :new, :create]
+ before_action :find_project_by_project_id, :only => [:index, :new, :create]
+ before_action :authorize
accept_api_auth :index, :show, :create, :update, :destroy
def index
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class IssueRelationsController < ApplicationController
- before_filter :find_issue, :authorize, :only => [:index, :create]
- before_filter :find_relation, :only => [:show, :destroy]
+ before_action :find_issue, :authorize, :only => [:index, :create]
+ before_action :find_relation, :only => [:show, :destroy]
accept_api_auth :index, :show, :create, :destroy
class IssueStatusesController < ApplicationController
layout 'admin'
- before_filter :require_admin, :except => :index
- before_filter :require_admin_or_api_request, :only => :index
+ before_action :require_admin, :except => :index
+ before_action :require_admin_or_api_request, :only => :index
accept_api_auth :index
def index
class IssuesController < ApplicationController
default_search_scope :issues
- before_filter :find_issue, :only => [:show, :edit, :update]
- before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :destroy]
- before_filter :authorize, :except => [:index, :new, :create]
- before_filter :find_optional_project, :only => [:index, :new, :create]
- before_filter :build_new_issue_from_params, :only => [:new, :create]
+ before_action :find_issue, :only => [:show, :edit, :update]
+ before_action :find_issues, :only => [:bulk_edit, :bulk_update, :destroy]
+ before_action :authorize, :except => [:index, :new, :create]
+ before_action :find_optional_project, :only => [:index, :new, :create]
+ before_action :build_new_issue_from_params, :only => [:new, :create]
accept_rss_auth :index, :show
accept_api_auth :index, :show, :create, :update, :destroy
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class JournalsController < ApplicationController
- before_filter :find_journal, :only => [:edit, :update, :diff]
- before_filter :find_issue, :only => [:new]
- before_filter :find_optional_project, :only => [:index]
- before_filter :authorize, :only => [:new, :edit, :update, :diff]
+ before_action :find_journal, :only => [:edit, :update, :diff]
+ before_action :find_issue, :only => [:new]
+ before_action :find_optional_project, :only => [:index]
+ before_action :authorize, :only => [:new, :edit, :update, :diff]
accept_rss_auth :index
menu_item :issues
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class MailHandlerController < ActionController::Base
- before_filter :check_credential
+ before_action :check_credential
# Displays the email submission form
def new
class MembersController < ApplicationController
model_object Member
- before_filter :find_model_object, :except => [:index, :new, :create, :autocomplete]
- before_filter :find_project_from_association, :except => [:index, :new, :create, :autocomplete]
- before_filter :find_project_by_project_id, :only => [:index, :new, :create, :autocomplete]
- before_filter :authorize
+ before_action :find_model_object, :except => [:index, :new, :create, :autocomplete]
+ before_action :find_project_from_association, :except => [:index, :new, :create, :autocomplete]
+ before_action :find_project_by_project_id, :only => [:index, :new, :create, :autocomplete]
+ before_action :authorize
accept_api_auth :index, :show, :create, :update, :destroy
require_sudo_mode :create, :update, :destroy
class MessagesController < ApplicationController
menu_item :boards
default_search_scope :messages
- before_filter :find_board, :only => [:new, :preview]
- before_filter :find_attachments, :only => [:preview]
- before_filter :find_message, :except => [:new, :preview]
- before_filter :authorize, :except => [:preview, :edit, :destroy]
+ before_action :find_board, :only => [:new, :preview]
+ before_action :find_attachments, :only => [:preview]
+ before_action :find_message, :except => [:new, :preview]
+ before_action :authorize, :except => [:preview, :edit, :destroy]
helper :boards
helper :watchers
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class MyController < ApplicationController
- before_filter :require_login
+ before_action :require_login
# let user change user's password when user has to
skip_before_filter :check_password_change, :only => :password
class NewsController < ApplicationController
default_search_scope :news
model_object News
- before_filter :find_model_object, :except => [:new, :create, :index]
- before_filter :find_project_from_association, :except => [:new, :create, :index]
- before_filter :find_project_by_project_id, :only => [:new, :create]
- before_filter :authorize, :except => [:index]
- before_filter :find_optional_project, :only => :index
+ before_action :find_model_object, :except => [:new, :create, :index]
+ before_action :find_project_from_association, :except => [:new, :create, :index]
+ before_action :find_project_by_project_id, :only => [:new, :create]
+ before_action :authorize, :except => [:index]
+ before_action :find_optional_project, :only => :index
accept_rss_auth :index
accept_api_auth :index
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class PreviewsController < ApplicationController
- before_filter :find_project, :find_attachments
+ before_action :find_project, :find_attachments
def issue
@issue = Issue.visible.find_by_id(params[:id]) unless params[:id].blank?
class PrincipalMembershipsController < ApplicationController
layout 'admin'
- before_filter :require_admin
- before_filter :find_principal, :only => [:new, :create]
- before_filter :find_membership, :only => [:update, :destroy]
+ before_action :require_admin
+ before_action :find_principal, :only => [:new, :create]
+ before_action :find_membership, :only => [:update, :destroy]
def new
@projects = Project.active.all
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class ProjectEnumerationsController < ApplicationController
- before_filter :find_project_by_project_id
- before_filter :authorize
+ before_action :find_project_by_project_id
+ before_action :authorize
def update
if params[:enumerations]
menu_item :overview
menu_item :settings, :only => :settings
- before_filter :find_project, :except => [ :index, :list, :new, :create, :copy ]
- before_filter :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy]
- before_filter :authorize_global, :only => [:new, :create]
- before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ]
+ before_action :find_project, :except => [ :index, :list, :new, :create, :copy ]
+ before_action :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy]
+ before_action :authorize_global, :only => [:new, :create]
+ before_action :require_admin, :only => [ :copy, :archive, :unarchive, :destroy ]
accept_rss_auth :index
accept_api_auth :index, :show, :create, :update, :destroy
require_sudo_mode :destroy
class QueriesController < ApplicationController
menu_item :issues
- before_filter :find_query, :except => [:new, :create, :index]
- before_filter :find_optional_project, :only => [:new, :create]
+ before_action :find_query, :except => [:new, :create, :index]
+ before_action :find_optional_project, :only => [:new, :create]
accept_api_auth :index
class ReportsController < ApplicationController
menu_item :issues
- before_filter :find_project, :authorize, :find_issue_statuses
+ before_action :find_project, :authorize, :find_issue_statuses
def issue_report
@trackers = @project.rolled_up_trackers(false).visible
menu_item :settings, :only => [:new, :create, :edit, :update, :destroy, :committers]
default_search_scope :changesets
- before_filter :find_project_by_project_id, :only => [:new, :create]
- before_filter :find_repository, :only => [:edit, :update, :destroy, :committers]
- before_filter :find_project_repository, :except => [:new, :create, :edit, :update, :destroy, :committers]
- before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
- before_filter :authorize
+ before_action :find_project_by_project_id, :only => [:new, :create]
+ before_action :find_repository, :only => [:edit, :update, :destroy, :committers]
+ before_action :find_project_repository, :except => [:new, :create, :edit, :update, :destroy, :committers]
+ before_action :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
+ before_action :authorize
accept_rss_auth :revisions
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
class RolesController < ApplicationController
layout 'admin'
- before_filter :require_admin, :except => [:index, :show]
- before_filter :require_admin_or_api_request, :only => [:index, :show]
- before_filter :find_role, :only => [:show, :edit, :update, :destroy]
+ before_action :require_admin, :except => [:index, :show]
+ before_action :require_admin_or_api_request, :only => [:index, :show]
+ before_action :find_role, :only => [:show, :edit, :update, :destroy]
accept_api_auth :index, :show
require_sudo_mode :create, :update, :destroy
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class SearchController < ApplicationController
- before_filter :find_optional_project
+ before_action :find_optional_project
accept_api_auth :index
def index
helper :queries
- before_filter :require_admin
+ before_action :require_admin
require_sudo_mode :index, :edit, :plugin
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class SysController < ActionController::Base
- before_filter :check_enabled
+ before_action :check_enabled
def projects
p = Project.active.has_module(:repository).
class TimelogController < ApplicationController
menu_item :issues
- before_filter :find_time_entry, :only => [:show, :edit, :update]
- before_filter :find_time_entries, :only => [:bulk_edit, :bulk_update, :destroy]
- before_filter :authorize, :only => [:show, :edit, :update, :bulk_edit, :bulk_update, :destroy]
+ before_action :find_time_entry, :only => [:show, :edit, :update]
+ before_action :find_time_entries, :only => [:bulk_edit, :bulk_update, :destroy]
+ before_action :authorize, :only => [:show, :edit, :update, :bulk_edit, :bulk_update, :destroy]
- before_filter :find_optional_issue, :only => [:new, :create]
- before_filter :find_optional_project, :only => [:index, :report]
- before_filter :authorize_global, :only => [:new, :create, :index, :report]
+ before_action :find_optional_issue, :only => [:new, :create]
+ before_action :find_optional_project, :only => [:index, :report]
+ before_action :authorize_global, :only => [:new, :create, :index, :report]
accept_rss_auth :index
accept_api_auth :index, :show, :create, :update, :destroy
class TrackersController < ApplicationController
layout 'admin'
- before_filter :require_admin, :except => :index
- before_filter :require_admin_or_api_request, :only => :index
+ before_action :require_admin, :except => :index
+ before_action :require_admin_or_api_request, :only => :index
accept_api_auth :index
def index
class UsersController < ApplicationController
layout 'admin'
- before_filter :require_admin, :except => :show
- before_filter :find_user, :only => [:show, :edit, :update, :destroy]
+ before_action :require_admin, :except => :show
+ before_action :find_user, :only => [:show, :edit, :update, :destroy]
accept_api_auth :index, :show, :create, :update, :destroy
helper :sort
class VersionsController < ApplicationController
menu_item :roadmap
model_object Version
- before_filter :find_model_object, :except => [:index, :new, :create, :close_completed]
- before_filter :find_project_from_association, :except => [:index, :new, :create, :close_completed]
- before_filter :find_project_by_project_id, :only => [:index, :new, :create, :close_completed]
- before_filter :authorize
+ before_action :find_model_object, :except => [:index, :new, :create, :close_completed]
+ before_action :find_project_from_association, :except => [:index, :new, :create, :close_completed]
+ before_action :find_project_by_project_id, :only => [:index, :new, :create, :close_completed]
+ before_action :authorize
accept_api_auth :index, :show, :create, :update, :destroy
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WatchersController < ApplicationController
- before_filter :require_login, :find_watchables, :only => [:watch, :unwatch]
+ before_action :require_login, :find_watchables, :only => [:watch, :unwatch]
def watch
set_watcher(@watchables, User.current, true)
set_watcher(@watchables, User.current, false)
end
- before_filter :find_project, :authorize, :only => [:new, :create, :append, :destroy, :autocomplete_for_user]
+ before_action :find_project, :authorize, :only => [:new, :create, :append, :destroy, :autocomplete_for_user]
accept_api_auth :create, :destroy
def new
# TODO: still being worked on
class WikiController < ApplicationController
default_search_scope :wiki_pages
- before_filter :find_wiki, :authorize
- before_filter :find_existing_or_new_page, :only => [:show, :edit, :update]
- before_filter :find_existing_page, :only => [:rename, :protect, :history, :diff, :annotate, :add_attachment, :destroy, :destroy_version]
+ before_action :find_wiki, :authorize
+ before_action :find_existing_or_new_page, :only => [:show, :edit, :update]
+ before_action :find_existing_page, :only => [:rename, :protect, :history, :diff, :annotate, :add_attachment, :destroy, :destroy_version]
+ before_action :find_attachments, :only => [:preview]
accept_api_auth :index, :show, :update, :destroy
- before_filter :find_attachments, :only => [:preview]
helper :attachments
include AttachmentsHelper
class WikisController < ApplicationController
menu_item :settings
- before_filter :find_project, :authorize
+ before_action :find_project, :authorize
# Create or update a project's wiki
def edit
class WorkflowsController < ApplicationController
layout 'admin'
- before_filter :require_admin
+ before_action :require_admin
def index
@roles = Role.sorted.select(&:consider_workflow?)
unloadable
layout 'base'
- before_filter :find_project, :authorize
+ before_action :find_project, :authorize
menu_item :sample_plugin
def say_hello
@sudo_form ||= SudoMode::Form.new
@sudo_form.original_fields = params.slice( *param_names )
# a simple 'render "sudo_mode/new"' works when used directly inside an
- # action, but not when called from a before_filter:
+ # action, but not when called from a before_action:
respond_to do |format|
format.html { render 'sudo_mode/new' }
format.js { render 'sudo_mode/new' }
actions = args.dup
options = actions.extract_options!
filter = SudoRequestFilter.new Array(options[:parameters]), Array(options[:only])
- before_filter filter, only: actions
+ before_action filter, only: actions
end
end
end