]>
gitweb.michael.orlitzky.com - mailshears.git/blob - lib/mv/plugins/agendav.rb
3 require 'common/agendav_plugin'
12 # It's obviously an error if the source user does not exist. It
13 # would also be an error if the destination domain didn't exist;
14 # however, Agendav doesn't know about domains, so we let that slide.
15 raise NonexistentUserError
.new(src
.to_s()) if not user_exists(src
)
17 # And it's an error if the destination user exists already.
18 raise UserAlreadyExistsError
.new(dst
.to_s()) if user_exists(dst
)
20 sql_queries
= ['UPDATE prefs SET username = $1 WHERE username = $2;']
21 sql_queries
<< 'UPDATE shared SET user_from = $1 WHERE user_from = $2;'
22 sql_queries
<< 'UPDATE shared SET user_which = $1 WHERE user_which = $2;'
24 connection
= PGconn
.connect(@db_host, @db_port, @db_opts, @db_tty,
25 @db_name, @db_user, @db_pass)
27 sql_queries
.each
do |sql_query
|
28 connection
.query(sql_query
, [dst
.to_s(), src
.to_s()])