2012-03-04 14:35:15 +01:00
|
|
|
class KeyObserver < ActiveRecord::Observer
|
2013-01-03 08:06:07 +01:00
|
|
|
include Gitolited
|
2012-08-28 23:04:06 +02:00
|
|
|
|
2012-03-04 14:35:15 +01:00
|
|
|
def after_save(key)
|
2013-01-03 08:06:07 +01:00
|
|
|
gitolite.set_key(key.identifier, key.key, key.projects)
|
2012-03-04 14:35:15 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def after_destroy(key)
|
2012-08-28 23:04:06 +02:00
|
|
|
return if key.is_deploy_key && !key.last_deploy?
|
2013-01-03 08:06:07 +01:00
|
|
|
gitolite.remove_key(key.identifier, key.projects)
|
2012-03-04 14:35:15 +01:00
|
|
|
end
|
|
|
|
end
|