]>
gitweb.michael.orlitzky.com - mailshears.git/blob - lib/prune/prune_plugin.rb
1 require 'common/plugin.rb'
3 # Plugins for pruning users. By "pruning," we mean the removal of
4 # leftover non-PostfixAdmin users after the associated user has been
5 # removed from the Postfixadmin database.
9 # Absorb the subclass run() magic from the Plugin::Run module.
12 # The runner class associated with pruning plugins.
14 # @return [Class] the {PruneRunner} class.
21 # The "dummy" runner class associated with pruning plugins.
23 # @return [Class] the {PruneDummyRunner} class.
26 return PruneDummyRunner
30 # Determine which domains are "left over" for this plugin. A domain
31 # is considered "left over" if it has been removed from Postfixadmin
32 # but not some other plugin.
34 # The leftovers are determined with respect to the list *db_domains*
35 # of domains that Postfixadmin knows about.
37 # @param db_domains [Array<Domain>] a list of domains that are present
38 # in the Postfixadmin database.
40 # @return [Array<Domain>] a list of domains known to this plugin but
41 # not to Postfixadmin.
43 def get_leftover_domains(db_domains
)
44 # WARNING! Array difference doesn't work for some reason.
45 return list_domains().select
{ |d
| !db_domains
.include?(d
) }
49 # Determine which users are "left over" for this plugin. A user
50 # is considered "left over" if it has been removed from Postfixadmin
51 # but not some other plugin.
53 # The leftovers are determined with respect to the list *db_users*
54 # of users that Postfixadmin knows about.
56 # @param db_users [Array<User>] a list of users that are present
57 # in the Postfixadmin database.
59 # @return [Array<User>] a list of users known to this plugin but
60 # not to Postfixadmin.
62 def get_leftover_users(db_users
)
63 # WARNING! Array difference doesn't work for some reason.
64 return list_users().select
{ |u
| !db_users
.include?(u
) }