2012-07-20 07:39:34 +02:00
|
|
|
class BaseContext
|
|
|
|
attr_accessor :project, :current_user, :params
|
|
|
|
|
|
|
|
def initialize(project, user, params)
|
|
|
|
@project, @current_user, @params = project, user, params.dup
|
|
|
|
end
|
2012-07-28 02:35:24 +02:00
|
|
|
|
|
|
|
def abilities
|
|
|
|
@abilities ||= begin
|
|
|
|
abilities = Six.new
|
|
|
|
abilities << Ability
|
|
|
|
abilities
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def can?(object, action, subject)
|
|
|
|
abilities.allowed?(object, action, subject)
|
|
|
|
end
|
2012-07-20 07:39:34 +02:00
|
|
|
end
|
|
|
|
|