diff options
author | Lukas Erlacher <erlacher@in.tum.de> | 2014-08-18 16:46:46 +0200 |
---|---|---|
committer | Lukas Erlacher <erlacher@in.tum.de> | 2014-09-03 01:27:02 +0200 |
commit | 40fc4261f2e6c8eaf6e885405863e929ecbd47b3 (patch) | |
tree | 236e7f674a1983e19a74507fc9d9b54021073caa /app/models/key.rb | |
parent | 00ccaed029efbbdff96a4b64628a3a2d9bf5125d (diff) | |
download | gitlab-ce-40fc4261f2e6c8eaf6e885405863e929ecbd47b3.tar.gz |
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.rb | 10 |
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 |