]>
gitweb.michael.orlitzky.com - mailshears.git/blob - lib/common/agendav_plugin.rb
fc19d3d60fd45fccfec195ca745de1c0d7b5b3b5
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
21 def describe_domain(domain
)
25 def describe_user(user
)
32 # Produce a list of AgenDAV users. This is public because it's
37 # Just assume PostgreSQL for now.
39 connection
= PGconn
.connect(@db_host,
47 sql_query
= '(SELECT username FROM prefs)'
49 sql_query +
= '(SELECT user_from FROM shared);'
51 connection
.query(sql_query
) do |result
|
52 users
= result
.field_values('username')
57 # Pretend like we're database-agnostic in case we ever are.
58 raise DatabaseError
.new(e
)
61 return users
.map
{ |u
| User
.new(u
) }