BigW Consortium Gitlab

base_context.rb 460 Bytes
Newer Older
Dmitriy Zaporozhets committed
1 2 3 4 5 6
class BaseContext
  attr_accessor :project, :current_user, :params

  def initialize(project, user, params)
    @project, @current_user, @params = project, user, params.dup
  end
randx committed
7 8 9 10 11 12 13 14 15 16 17 18

  def abilities
    @abilities ||= begin
                     abilities = Six.new
                     abilities << Ability
                     abilities
                   end
  end

  def can?(object, action, subject)
    abilities.allowed?(object, action, subject)
  end
Dmitriy Zaporozhets committed
19 20
end