diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-15 15:08:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-15 15:08:44 +0300 |
commit | 67441623767b3084d594288408bb078b2eb9f83e (patch) | |
tree | 0593430be110f1cbf67531081b0b8e5784efa6e4 /app/services/keys | |
parent | b109901317f810e6708d4165e52b334b70297beb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/keys')
-rw-r--r-- | app/services/keys/create_service.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/services/keys/create_service.rb b/app/services/keys/create_service.rb index 32c4ab645df..c256de7b35d 100644 --- a/app/services/keys/create_service.rb +++ b/app/services/keys/create_service.rb @@ -2,6 +2,14 @@ module Keys class CreateService < ::Keys::BaseService + attr_accessor :current_user + + def initialize(current_user, params = {}) + @current_user, @params = current_user, params + @ip_address = @params.delete(:ip_address) + @user = params.delete(:user) || current_user + end + def execute key = user.keys.create(params) notification_service.new_key(key) if key.persisted? |