]>
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_queries
= ['DELETE FROM usr WHERE username = $1']
28 connection
= PGconn
.connect(@db_host, @db_port, @db_opts, @db_tty,
29 @db_name, @db_user, @db_pass)
31 sql_queries
.each
do |sql_query
|
32 connection
.query(sql_query
, [user
.to_s()])