]>
gitweb.michael.orlitzky.com - mailshears.git/blob - 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;'
25 connection
= PGconn
.connect(@db_host,
33 sql_queries
.each
do |sql_query
|
34 connection
.query(sql_query
, [dst
.to_s(), src
.to_s()])
40 # Pretend like we're database-agnostic in case we ever are.
41 raise DatabaseError
.new(e
)