commit
1950e0fd10
@ -1,36 +0,0 @@ |
||||
#-- copyright |
||||
# OpenProject Costs Plugin |
||||
# |
||||
# Copyright (C) 2009 - 2014 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# version 3. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
#++ |
||||
|
||||
module OpenProject::Costs::Patches::ApplicationControllerPatch |
||||
def self.included(base) # :nodoc: |
||||
base.send(:include, InstanceMethods) |
||||
|
||||
base.class_eval do |
||||
alias_method_chain :authorize, :for_user |
||||
end |
||||
end |
||||
|
||||
module InstanceMethods |
||||
# Authorize the user for the requested action |
||||
def authorize_with_for_user(ctrl = params[:controller], action = params[:action], global = false, for_user=@user) |
||||
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project || @projects, :global => global, :for => for_user) |
||||
allowed ? true : deny_access |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue