]> gitweb.michael.orlitzky.com - mailshears.git/blobdiff - lib/rm/plugins/davical.rb
Overhaul everything to get consistent error reports.
[mailshears.git] / lib / rm / plugins / davical.rb
index ce5828a627b3cf72a29069815feab17660a07267..3526dcff2fa4f9fc57950c32ac50e34c44d6872c 100644 (file)
@@ -12,15 +12,12 @@ class DavicalRm
   include RmPlugin
 
 
-  def delete_domain(domain)
-    # DAViCal doesn't have a concept of domains.
-  end
-
-
-  def delete_account(account)
+  def delete_user(user)
     # Delete the given username. DAViCal uses foreign keys properly
     # and only supports postgres, so we let the ON DELETE CASCADE
     # trigger handle most of the work.
+    raise NonexistentUserError.new(user.to_s()) if not user_exists(user)
+
     sql_queries = ['DELETE FROM usr WHERE username = $1']
 
     begin
@@ -33,7 +30,7 @@ class DavicalRm
                                   @db_pass)
 
       sql_queries.each do |sql_query|
-        connection.query(sql_query, [account])
+        connection.query(sql_query, [user.to_s()])
       end
 
       connection.close()
@@ -46,14 +43,4 @@ class DavicalRm
   end
 
 
-
-  def get_domain_usernames(domain)
-    usernames = get_davical_usernames();
-    matches = usernames.select do |username|
-      username =~ /@#{domain}$/
-    end
-
-    return matches
-  end
-
 end