]>
gitweb.michael.orlitzky.com - mailshears.git/blob - lib/common/plugin.rb
1 # All plugins should include this module. It defines the basic
2 # operations that all plugins are supposed to support.
6 # Callback, called whenever another class or module includes this
7 # one. The parameter given is the name of the class or module
17 def describe_domain(domain
)
18 # Provide a "description" of the domain. This is output along
19 # with the domain name and can be anything of use to the system
21 raise NotImplementedError
24 def describe_account(account
)
25 # Provide a "description" of the account. This is output along
26 # with the domain name and can be anything of use to the system
28 raise NotImplementedError
32 # Return a list of all users managed by this plugin.
33 raise NotImplementedError
36 def list_domains_users(domains
)
37 # Get all usernames belonging to the given domains. If a username
38 # ends in @example.com, it belongs to the domain example.com
40 # This uses a naive loop, but relies only on the existence of a
41 # list_users() method which is guaranteed above. More efficient
42 # implementations can usually be made within the plugin.
45 usernames
= list_users();
47 matches
= usernames
.select
do |username
|
51 domains_users +
= matches