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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
82829ed4
Commit
82829ed4
authored
Dec 30, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move user key manipulation in admin section to a separate controller.
parent
c1e57b47
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
29 deletions
+41
-29
app/controllers/admin/keys_controller.rb
app/controllers/admin/keys_controller.rb
+34
-0
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+0
-21
app/views/admin/keys/show.html.haml
app/views/admin/keys/show.html.haml
+4
-0
app/views/admin/users/key.html.haml
app/views/admin/users/key.html.haml
+0
-4
app/views/admin/users/show.html.haml
app/views/admin/users/show.html.haml
+2
-2
config/routes.rb
config/routes.rb
+1
-2
No files found.
app/controllers/admin/keys_controller.rb
0 → 100644
View file @
82829ed4
class
Admin::KeysController
<
Admin
::
ApplicationController
before_filter
:user
,
only:
[
:show
,
:destroy
]
def
show
@key
=
user
.
keys
.
find
(
params
[
:id
])
respond_to
do
|
format
|
format
.
html
format
.
js
{
render
nothing:
true
}
end
end
def
destroy
key
=
user
.
keys
.
find
(
params
[
:id
])
respond_to
do
|
format
|
if
key
.
destroy
format
.
html
{
redirect_to
[
:admin
,
user
],
notice:
'User key was successfully removed.'
}
else
format
.
html
{
redirect_to
[
:admin
,
user
],
alert:
'Failed to remove user key.'
}
end
end
end
protected
def
user
@user
||=
User
.
find_by!
(
username:
params
[
:user_id
])
end
def
key_params
params
.
require
(
:user_id
,
:id
)
end
end
app/controllers/admin/users_controller.rb
View file @
82829ed4
...
...
@@ -108,27 +108,6 @@ class Admin::UsersController < Admin::ApplicationController
end
end
def
show_key
@key
=
user
.
keys
.
find
(
params
[
:key_id
])
respond_to
do
|
format
|
format
.
html
{
render
'key'
}
format
.
js
{
render
nothing:
true
}
end
end
def
remove_key
key
=
user
.
keys
.
find
(
params
[
:key_id
])
respond_to
do
|
format
|
if
key
.
destroy
format
.
html
{
redirect_to
[
:admin
,
user
],
notice:
'User key was successfully removed.'
}
else
format
.
html
{
redirect_to
[
:admin
,
user
],
alert:
'Failed to remove user key.'
}
end
end
end
protected
def
user
...
...
app/views/admin/keys/show.html.haml
0 → 100644
View file @
82829ed4
=
render
"profiles/keys/key_details"
.pull-right
=
link_to
'Remove'
,
admin_user_key_path
(
@user
,
@key
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-remove delete-key"
app/views/admin/users/key.html.haml
deleted
100644 → 0
View file @
c1e57b47
=
render
"profiles/keys/key_details"
.pull-right
=
link_to
'Remove'
,
remove_user_key_admin_user_path
(
@user
,
@key
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-remove delete-key"
app/views/admin/users/show.html.haml
View file @
82829ed4
...
...
@@ -232,7 +232,7 @@
-
@ssh_keys
.
each
do
|
key
|
%tr
%td
=
link_to
user_key_admin_user
_path
(
@user
,
key
)
do
=
link_to
admin_user_key
_path
(
@user
,
key
)
do
%strong
=
key
.
title
%td
%span
...
...
@@ -240,7 +240,7 @@
%span
.cgray
added
#{
time_ago_with_tooltip
(
key
.
created_at
)
}
%td
=
link_to
'Remove'
,
remove_user_key_admin_user
_path
(
@user
,
key
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-small btn-remove delete-key pull-right"
=
link_to
'Remove'
,
admin_user_key
_path
(
@user
,
key
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-small btn-remove delete-key pull-right"
-
else
.nothing-here-block
User has no ssh keys
config/routes.rb
View file @
82829ed4
...
...
@@ -80,12 +80,11 @@ Gitlab::Application.routes.draw do
#
namespace
:admin
do
resources
:users
,
constraints:
{
id:
/[a-zA-Z.\/0-9_\-]+/
}
do
resources
:keys
,
only:
[
:show
,
:destroy
]
member
do
put
:team_update
put
:block
put
:unblock
get
'key/:key_id'
,
action:
'show_key'
,
as:
'user_key'
delete
'key/:key_id'
,
action:
'remove_key'
,
as:
'remove_user_key'
delete
'remove/:email_id'
,
action:
'remove_email'
,
as:
'remove_email'
end
end
...
...
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