]>
gitweb.michael.orlitzky.com - mailshears.git/blob - lib/common/agendav_plugin.rb
032d057c24d8e25c899ea672ae5fca50a711a8ff
1 require 'common/plugin'
5 # Code that all Agendav plugins (Prune, Rm, Mv...) will
6 # share. That is, we implement the Plugin interface.
11 @db_host = cfg
.agendav_dbhost
12 @db_port = cfg
.agendav_dbport
13 @db_opts = cfg
.agendav_dbopts
14 @db_tty = cfg
.agendav_dbtty
15 @db_name = cfg
.agendav_dbname
16 @db_user = cfg
.agendav_dbuser
17 @db_pass = cfg
.agendav_dbpass
23 # Produce a list of AgenDAV users. This is public because it's
28 # Just assume PostgreSQL for now.
30 connection
= PGconn
.connect(@db_host,
38 sql_query
= '(SELECT username FROM prefs)'
40 sql_query +
= '(SELECT user_from FROM shared);'
42 connection
.query(sql_query
) do |result
|
43 users
= result
.field_values('username')
48 # Pretend like we're database-agnostic in case we ever are.
49 raise DatabaseError
.new(e
)
52 return users
.map
{ |u
| User
.new(u
) }