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.

25 lines
688 B

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