]> gitweb.michael.orlitzky.com - mailshears.git/blobdiff - lib/common/davical_plugin.rb
Way too many changes to mention. The 'rm' mode works now.
[mailshears.git] / lib / common / davical_plugin.rb
index e4bef48ac41239f49b7aa3656adbce782f25bd00..cdde3d1e068301fbd13a3eb05783fed7f878d8bc 100644 (file)
@@ -70,4 +70,31 @@ module DavicalPlugin
   end
 
 
+  def get_davical_usernames()
+    usernames = []
+
+    begin
+      connection = PGconn.connect(@db_host,
+                                  @db_port,
+                                  @db_opts,
+                                  @db_tty,
+                                  @db_name,
+                                  @db_user,
+                                  @db_pass)
+
+      sql_query =  "SELECT username FROM usr"
+
+      connection.query(sql_query) do |result|
+        usernames = result.field_values('username')
+      end
+
+      connection.close()
+    rescue PGError => e
+      # Pretend like we're database-agnostic in case we ever are.
+      raise DatabaseError.new(e)
+    end
+
+    return usernames
+  end
+
 end