gitlab-org--gitlab-foss/app/services/base_service.rb
Dmitriy Zaporozhets 1d2bdb4d58
Move all Context classes into Services
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-01-16 19:03:42 +02:00

19 lines
459 B
Ruby

class BaseService
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