module PrunePlugin

Plugins for pruning users. By “pruning,” we mean the removal of leftover non-PostfixAdmin users after the associated user has been removed from the Postfixadmin database.

Public Class Methods

dummy_runner() click to toggle source

The “dummy” runner class associated with pruning plugins.

@return [Class] the {PruneDummyRunner} class.

# File lib/prune/prune_plugin.rb, line 25
def self.dummy_runner
  return PruneDummyRunner
end
runner() click to toggle source

The runner class associated with pruning plugins.

@return [Class] the {PruneRunner} class.

# File lib/prune/prune_plugin.rb, line 16
def self.runner()
  return PruneRunner
end

Public Instance Methods

get_leftover_domains(db_domains) click to toggle source

Determine which domains are “left over” for this plugin. A domain is considered “left over” if it has been removed from Postfixadmin but not some other plugin.

The leftovers are determined with respect to the list db_domains of domains that Postfixadmin knows about.

@param db_domains [Array<Domain>] a list of domains that are present

in the Postfixadmin database.

@return [Array<Domain>] a list of domains known to this plugin but

not to Postfixadmin.
# File lib/prune/prune_plugin.rb, line 43
def get_leftover_domains(db_domains)
  # WARNING! Array difference doesn't work for some reason.
  return list_domains().select{ |d| !db_domains.include?(d) }
end
get_leftover_users(db_users) click to toggle source

Determine which users are “left over” for this plugin. A user is considered “left over” if it has been removed from Postfixadmin but not some other plugin.

The leftovers are determined with respect to the list db_users of users that Postfixadmin knows about.

@param db_users [Array<User>] a list of users that are present

in the Postfixadmin database.

@return [Array<User>] a list of users known to this plugin but

not to Postfixadmin.
# File lib/prune/prune_plugin.rb, line 62
def get_leftover_users(db_users)
  # WARNING! Array difference doesn't work for some reason.
  return list_users().select{ |u| !db_users.include?(u) }
end