module RmPlugin

Plugins for the removal of users and domains.

Public Class Methods

dummy_runner() click to toggle source

The “dummy” runner class associated with removal plugins.

@return [Class] the {RmDummyRunner} class.

# File lib/rm/rm_plugin.rb, line 24
def self.dummy_runner()
  return RmDummyRunner
end
runner() click to toggle source

The runner class associated with removal plugins.

@return [Class] the {RmRunner} class.

# File lib/rm/rm_plugin.rb, line 15
def self.runner()
  return RmRunner
end

Public Instance Methods

remove(target) click to toggle source

Remove the target domain or user. This is a generic version of the {#remove_user} and {#remove_domain} operations that will dispatch based on the type of target.

@param target [User,Domain] the user or domain to remove.

# File lib/rm/rm_plugin.rb, line 35
def remove(target)
  # A generic version of remove_user/remove_domain that
  # dispatches base on the class of the target.
  if target.is_a?(User)
    return remove_user(target)
  elsif target.is_a?(Domain)
    return remove_domain(target)
  else
    raise NotImplementedError
  end
end
remove_domain(domain) click to toggle source

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.

# File lib/rm/rm_plugin.rb, line 54
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
end
remove_user(user) click to toggle source

The interface for the “remove a user” operation. Subclasses need to implement this method so that it removes user.

@param user [User] the user to remove.

# File lib/rm/rm_plugin.rb, line 73
def remove_user(user)
  raise NotImplementedError
end