gitlab-org--gitlab-foss/app/contexts/base_context.rb
Dmitriy Zaporozhets f61850e6e3
Move part of file creation logic into separate context
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2013-11-05 12:06:52 +02:00

19 lines
459 B
Ruby

class BaseContext
attr_accessor :project, :current_user, :params
def initialize(project, user, params)
@project, @current_user, @params = project, user, params.dup
end
def abilities
@abilities ||= begin
abilities = Six.new
abilities << Ability
abilities
end
end
def can?(object, action, subject)
abilities.allowed?(object, action, subject)
end
end