Allow the getting of a dovecot user path even if it doesn't exist.
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 30 Oct 2015 00:57:44 +0000 (20:57 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 30 Oct 2015 00:57:44 +0000 (20:57 -0400)
lib/common/dovecot_plugin.rb

index 02e92957cf6994df0e01ebc1a67fa4d07ffbe591..dfd87494c797642d68614ad3ca8e0a0f5a6169ad 100644 (file)
@@ -45,9 +45,10 @@ module DovecotPlugin
   end
 
 
-  def get_user_path(user)
-    # Return the filesystem path of this user's mailbox.
-    # Only works if the user exists!
+  def get_user_path(user, existence_check = true)
+    # Return the filesystem path of this user's mailbox. With
+    # existence_check = true, it only works if the user exists!
+    # We always require that the domain exists.
     if not user.include?('@')
       msg = "#{user}: Users must contain an '@' symbol."
       raise InvalidUserError.new(msg)
@@ -65,6 +66,8 @@ module DovecotPlugin
 
     user_path = File.join(domain_path, local_part)
 
+    return user_path if not existence_check
+
     if File.directory?(user_path)
       return user_path
     else