diff options
author | Azul <azul@riseup.net> | 2013-11-18 17:20:51 +0100 |
---|---|---|
committer | Azul <azul@riseup.net> | 2013-11-18 17:21:00 +0100 |
commit | 0cc941bb4e46489fb6eb9f8f3282ee3a6c046449 (patch) | |
tree | db94d9b6e1a84bf231d1a78dda4be23a94d161bb /lib | |
parent | bff519f9842e43ad7a5b5e4836d9b73ceeff4681 (diff) |
delete user db's on user deletion.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tapicero/user_database.rb | 5 | ||||
-rw-r--r-- | lib/tapicero_daemon.rb | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/tapicero/user_database.rb b/lib/tapicero/user_database.rb index 84ed300..ec2694a 100644 --- a/lib/tapicero/user_database.rb +++ b/lib/tapicero/user_database.rb @@ -24,6 +24,11 @@ module Tapicero CouchRest.put security_url, security end + def destroy + db = CouchRest.new(host).database(name) + db.delete! if db + end + protected def secured? diff --git a/lib/tapicero_daemon.rb b/lib/tapicero_daemon.rb index bb1a818..3a26296 100644 --- a/lib/tapicero_daemon.rb +++ b/lib/tapicero_daemon.rb @@ -22,7 +22,9 @@ module Tapicero end users.deleted do |hash| - Tapicero.logger.debug "Deleted user " + hash.to_json + puts "Deleted user " + hash['id'] + db = UserDatabase.new(Config.couch_host, Config.db_prefix + hash['id']) + db.destroy end users.listen |