]>
gitweb.michael.orlitzky.com - mailshears.git/blob - lib/common/agendav_plugin.rb
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 connection
= PGconn
.connect(@db_host, @db_port, @db_opts, @db_tty,
29 @db_name, @db_user, @db_pass)
31 sql_query
= '(SELECT username FROM prefs)'
33 sql_query +
= '(SELECT user_from FROM shared);'
35 connection
.query(sql_query
) do |result
|
36 users
= result
.field_values('username')
41 return users
.map
{ |u
| User
.new(u
) }