Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
20e045b1
Commit
20e045b1
authored
Jun 07, 2020
by
Rajendra Kadam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change initializer in KeyService
parent
b35739d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
app/services/keys/create_service.rb
app/services/keys/create_service.rb
+5
-0
lib/api/users.rb
lib/api/users.rb
+1
-1
No files found.
app/services/keys/create_service.rb
View file @
20e045b1
...
...
@@ -2,6 +2,11 @@
module
Keys
class
CreateService
<
::
Keys
::
BaseService
def
initialize
(
current_user
,
params
=
{})
@current_user
,
@params
,
@user
=
current_user
,
params
,
params
.
delete
(
:user
)
@ip_address
=
@params
.
delete
(
:ip_address
)
end
def
execute
key
=
user
.
keys
.
create
(
params
)
notification_service
.
new_key
(
key
)
if
key
.
persisted?
...
...
lib/api/users.rb
View file @
20e045b1
...
...
@@ -264,7 +264,7 @@ module API
user
=
User
.
find_by
(
id:
params
.
delete
(
:id
))
not_found!
(
'User'
)
unless
user
key
=
::
Keys
::
CreateService
.
new
(
user
,
declared_params
(
include_missing:
false
)).
execute
key
=
::
Keys
::
CreateService
.
new
(
current_user
,
declared_params
(
include_missing:
false
).
merge
(
user:
user
)).
execute
if
key
.
persisted?
present
key
,
with:
Entities
::
SSHKey
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment