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
0643187c
Commit
0643187c
authored
Oct 02, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix keys controller and remove old version
parent
577f2ceb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
36 deletions
+3
-36
app/controllers/profiles/keys_controller.rb
app/controllers/profiles/keys_controller.rb
+2
-9
ee/app/controllers/ee/profiles/keys_controller.rb
ee/app/controllers/ee/profiles/keys_controller.rb
+0
-26
ee/app/services/ee/keys/create_service.rb
ee/app/services/ee/keys/create_service.rb
+1
-1
No files found.
app/controllers/profiles/keys_controller.rb
View file @
0643187c
class
Profiles::KeysController
<
Profiles
::
ApplicationController
prepend
::
EE
::
Profiles
::
KeysController
skip_before_action
:authenticate_user!
,
only:
[
:get_keys
]
...
...
@@ -16,7 +15,7 @@ class Profiles::KeysController < Profiles::ApplicationController
@key
=
Keys
::
CreateService
.
new
(
current_user
,
key_params
).
execute
if
@key
.
persisted?
redirect_to
_profile_key_path
redirect_to
profile_key_path
(
@key
)
else
@keys
=
current_user
.
keys
.
select
(
&
:persisted?
)
render
:index
...
...
@@ -52,15 +51,9 @@ class Profiles::KeysController < Profiles::ApplicationController
end
end
protected
def
redirect_to_profile_key_path
redirect_to
profile_key_path
(
@key
)
end
private
def
key_params
params
.
require
(
:key
).
permit
(
:title
,
:key
)
params
.
require
(
:key
).
permit
(
:title
,
:key
)
.
merge
(
ip_address:
request
.
remote_ip
)
end
end
ee/app/controllers/ee/profiles/keys_controller.rb
deleted
100644 → 0
View file @
577f2ceb
module
EE
module
Profiles
module
KeysController
protected
def
redirect_to_profile_key_path
raise
NotImplementedError
unless
defined?
(
super
)
log_audit_event
super
end
private
def
log_audit_event
::
AuditEventService
.
new
(
current_user
,
current_user
,
action: :custom
,
custom_message:
'Added SSH key'
,
ip_address:
request
.
remote_ip
)
.
for_user
(
@key
.
title
).
security_event
end
end
end
end
ee/app/services/ee/keys/create_service.rb
View file @
0643187c
...
...
@@ -4,7 +4,7 @@ module EE
def
initialize
(
user
,
params
)
super
(
user
,
params
)
@ip_address
=
params
.
delete
(
:ip_address
)
@ip_address
=
@
params
.
delete
(
:ip_address
)
end
def
execute
...
...
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