- def delete_account(account)
- # Delete the given account.
- raise NotImplementedError
+
+ # Remove the given *domain*. Some plugins don't have a concept of
+ # domains, so the default implementation here removes all users that
+ # look like they belong to *domain*. Subclasses can be smarter.
+ #
+ # @param domain [Domain] the domain to remove.
+ #
+ def remove_domain(domain)
+ users = list_domains_users([domain])
+
+ # It's possible for a domain to exist with no users, but this
+ # default implementation is based on the assumption that it should
+ # work for plugins having no "domain" concept.
+ raise NonexistentDomainError.new(domain.to_s()) if users.empty?
+
+ users.each do |u|
+ remove_user(u)
+ end