mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-09 09:24:23 -05:00
Update auth_helper.rb
This commit is contained in:
@@ -17,20 +17,20 @@ module AuthHelper
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def allowed_to?(user, action)
|
def allowed_to?(action)
|
||||||
return false if user.nil?
|
return false if User.current.nil?
|
||||||
project = Project.find(params[:project_id])
|
project = Project.find(params[:project_id])
|
||||||
return false if project.nil?
|
return false if project.nil?
|
||||||
return true if user.allowed_to?(action, project)
|
return true if User.current.allowed_to?(action, project)
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def global_allowed_to?(user, action)
|
def global_allowed_to?( action)
|
||||||
return false if user.nil?
|
return false if User.current.nil?
|
||||||
|
|
||||||
projects = Project.all
|
projects = Project.all
|
||||||
projects.each { |p|
|
projects.each { |p|
|
||||||
if user.allowed_to?(action, p)
|
if User.current.allowed_to?(action, p)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user