You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

24 lines
688 B

class Ability
include CanCan::Ability
attr_accessor :user
attr_accessor :context
def initialize(options)
@user = options[:user] || User.new
@context = options[:context] || :application
if user.persisted?
# can manage his domains and records
can :manage, Domain, :user_id => user.id
can :manage, Record, :domain => {:user_id => user.id}
cannot :delete, SOA # it's deleted with the parent domain
# can manage his hosts
can :manage, A, :user_id => user.id #, :domain => {:name => Settings.host_domains}
end
# See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilities
end
end