]> gitweb.michael.orlitzky.com - mailshears.git/blob - lib/rm/rm_plugin.rb
Rename plugin_class to plugin_module.
[mailshears.git] / lib / rm / rm_plugin.rb
1 module RmPlugin
2 #
3 # Plugins for the removal of users.
4 #
5
6 def RmPlugin.included(c)
7 # Callback, called whenever another class or module includes this
8 # one. The parameter given is the name of the class or module
9 # that included us.
10 @includers ||= []
11 @includers << c
12 end
13
14 def RmPlugin.includers
15 return @includers
16 end
17
18 def runner()
19 return RmRunner
20 end
21
22 def dummy_runner()
23 return RmDummyRunner
24 end
25
26 def delete_domain(domain)
27 # Delete the given domain. Some plugins don't have a concept of
28 # domains, so just delete all users with a username that looks
29 # like it's in the given domain.
30 usernames = list_domains_users([domain])
31
32 raise NonexistentDomainError.new(domain) if usernames.empty?
33
34 usernames.each do |u|
35 delete_user(u)
36 end
37 end
38
39 def delete_user(user)
40 # Delete the given user.
41 raise NotImplementedError
42 end
43
44 end