X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Fcommon%2Fplugin.rb;fp=lib%2Fcommon%2Fplugin.rb;h=77d80c469e7b1e94f794b84b0c532f632765f77e;hp=633c8fd26d0c2f4bd467ff3d33aa3a48cc1a93fc;hb=bd2dabf89ab277fbe315b05e6dfa839afb5ce5ef;hpb=483d14dc8228a81d12fb109d3ed6510e2d2b03c1 diff --git a/lib/common/plugin.rb b/lib/common/plugin.rb index 633c8fd..77d80c4 100644 --- a/lib/common/plugin.rb +++ b/lib/common/plugin.rb @@ -33,6 +33,14 @@ module Plugin raise NotImplementedError end + def user_exists(username) + # Does the given username exist for this plugin? We use a naive + # implementation here based on list_users() which is required to + # exist above. Plugins can override this with something fast. + users = list_users() + return users.include?(username) + end + def list_domains_users(domains) # Get all usernames belonging to the given domains. If a username # ends in @example.com, it belongs to the domain example.com