class DovecotRm

Handle the removal of users and domains from the Dovecot mailstore (the filesystem).

Public Instance Methods

remove_domain(domain) click to toggle source

Remove domain from the Dovecot mailstore. This just runs “rm -r” on the domain directory if it exists.

@param domain [Domain] the domain to remove.

# File lib/rm/plugins/dovecot.rb, line 21
def remove_domain(domain)
  domain_path = self.get_domain_path(domain)

  if not File.directory?(domain_path)
    raise NonexistentDomainError.new(domain.to_s())
  end

  FileUtils.rm_r(domain_path)
end
remove_user(user) click to toggle source

Remove user from the Dovecot mailstore. This just runs “rm -r” on the user's mailbox directory, if it exists.

@param user [User] the user whose mailbox directory we want to

remove.
# File lib/rm/plugins/dovecot.rb, line 38
def remove_user(user)
  user_path = self.get_user_path(user)

  if not File.directory?(user_path)
    raise NonexistentUserError.new(user.to_s())
  end

  FileUtils.rm_r(user_path)
end