]>
gitweb.michael.orlitzky.com - mailshears.git/blob - lib/rm/plugins/davical.rb
3 require 'common/davical_plugin'
6 # Handle the removal of DAViCal users from its database. DAViCal has
7 # no concept of domains.
15 # Remove *user* from the DAViCal database. This should remove him
16 # from _every_ table in which he is referenced. Fortunately, DAViCal
17 # uses foreign keys properly (and only supports postgres, where they
18 # work!), so we can let the ON DELETE CASCADE trigger handle most of
21 # @param user [User] the user to remove.
24 raise NonexistentUserError
.new(user
.to_s()) if not user_exists(user
)
26 sql_query
= 'DELETE FROM usr WHERE username = $1;'
28 connection
= PG
::Connection.new(@db_hash)
30 connection
.sync_exec_params(sql_query
, [user
.to_s()])
32 # Make sure the connection gets closed even if the query explodes.