Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Erlacher <erlacher@in.tum.de>2014-08-18 18:46:46 +0400
committerLukas Erlacher <erlacher@in.tum.de>2014-09-03 03:27:02 +0400
commit40fc4261f2e6c8eaf6e885405863e929ecbd47b3 (patch)
tree236e7f674a1983e19a74507fc9d9b54021073caa /app/models/key.rb
parent00ccaed029efbbdff96a4b64628a3a2d9bf5125d (diff)
Add system hook for ssh key changes
Add system hook for ssh key create and destroy Update and fix documentation Update tests
Diffstat (limited to 'app/models/key.rb')
-rw-r--r--app/models/key.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/key.rb b/app/models/key.rb
index d59993b1905..095c73d8baf 100644
--- a/app/models/key.rb
+++ b/app/models/key.rb
@@ -29,7 +29,9 @@ class Key < ActiveRecord::Base
after_create :add_to_shell
after_create :notify_user
+ after_create :post_create_hook
after_destroy :remove_from_shell
+ after_destroy :post_destroy_hook
def strip_white_space
self.key = key.strip unless key.blank?
@@ -56,6 +58,10 @@ class Key < ActiveRecord::Base
NotificationService.new.new_key(self)
end
+ def post_create_hook
+ SystemHooksService.new.execute_hooks_for(self, :create)
+ end
+
def remove_from_shell
GitlabShellWorker.perform_async(
:remove_key,
@@ -64,6 +70,10 @@ class Key < ActiveRecord::Base
)
end
+ def post_destroy_hook
+ SystemHooksService.new.execute_hooks_for(self, :destroy)
+ end
+
private
def generate_fingerpint