Don't include RmPlugin from PrunePlugin (pointless; also crashes tests!).
[mailshears.git] / lib / prune / prune_plugin.rb
1 require 'rm/rm_plugin'
2
3 module PrunePlugin
4 #
5 # Plugins for the removal of leftover non-PostfixAdmin users,
6 # i.e. after an user has been removed from the PostfixAdmin
7 # database.
8 #
9 extend Plugin::Run
10
11 def self.runner()
12 return PruneRunner
13 end
14
15 def self.dummy_runner
16 return PruneDummyRunner
17 end
18
19 def get_leftover_domains(db_domains)
20 # Given a list of domains, determine which domains belonging to
21 # this plugin are not contained in the given list.
22
23 # WARNING! Array difference doesn't work for some reason.
24 return list_domains().select{ |d| !db_domains.include?(d) }
25 end
26
27 def get_leftover_users(db_users)
28 # Given a list of users, determine which users belonging to
29 # this plugin are not contained in the given list.
30
31 # WARNING! Array difference doesn't work for some reason.
32 return list_users().select{ |u| !db_users.include?(u) }
33 end
34 end