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