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
Kazuhiko Shiozaki
gitlab-ce
Commits
492f3a47
Commit
492f3a47
authored
Dec 29, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add user key actions to admins.
parent
75043a9e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
1 deletion
+52
-1
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+23
-1
app/views/admin/users/show.html.haml
app/views/admin/users/show.html.haml
+27
-0
config/routes.rb
config/routes.rb
+2
-0
No files found.
app/controllers/admin/users_controller.rb
View file @
492f3a47
...
@@ -11,6 +11,7 @@ class Admin::UsersController < Admin::ApplicationController
...
@@ -11,6 +11,7 @@ class Admin::UsersController < Admin::ApplicationController
def
show
def
show
@personal_projects
=
user
.
personal_projects
@personal_projects
=
user
.
personal_projects
@joined_projects
=
user
.
projects
.
joined
(
@user
)
@joined_projects
=
user
.
projects
.
joined
(
@user
)
@ssh_keys
=
user
.
keys
.
order
(
'id DESC'
)
end
end
def
new
def
new
...
@@ -107,6 +108,27 @@ class Admin::UsersController < Admin::ApplicationController
...
@@ -107,6 +108,27 @@ class Admin::UsersController < Admin::ApplicationController
end
end
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
protected
def
user
def
user
...
@@ -118,7 +140,7 @@ class Admin::UsersController < Admin::ApplicationController
...
@@ -118,7 +140,7 @@ class Admin::UsersController < Admin::ApplicationController
:email
,
:remember_me
,
:bio
,
:name
,
:username
,
:email
,
:remember_me
,
:bio
,
:name
,
:username
,
:skype
,
:linkedin
,
:twitter
,
:website_url
,
:color_scheme_id
,
:theme_id
,
:force_random_password
,
:skype
,
:linkedin
,
:twitter
,
:website_url
,
:color_scheme_id
,
:theme_id
,
:force_random_password
,
:extern_uid
,
:provider
,
:password_expires_at
,
:avatar
,
:hide_no_ssh_key
,
:extern_uid
,
:provider
,
:password_expires_at
,
:avatar
,
:hide_no_ssh_key
,
:projects_limit
,
:can_create_group
,
:admin
:projects_limit
,
:can_create_group
,
:admin
,
:key_id
)
)
end
end
end
end
app/views/admin/users/show.html.haml
View file @
492f3a47
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
%a
{
"data-toggle"
=>
"tab"
,
href:
"#groups"
}
Groups
%a
{
"data-toggle"
=>
"tab"
,
href:
"#groups"
}
Groups
%li
%li
%a
{
"data-toggle"
=>
"tab"
,
href:
"#projects"
}
Projects
%a
{
"data-toggle"
=>
"tab"
,
href:
"#projects"
}
Projects
%li
%a
{
"data-toggle"
=>
"tab"
,
href:
"#ssh-keys"
}
SSH keys
.tab-content
.tab-content
#account
.tab-pane.active
#account
.tab-pane.active
...
@@ -217,3 +219,28 @@
...
@@ -217,3 +219,28 @@
-
if
tm
.
respond_to?
:project
-
if
tm
.
respond_to?
:project
=
link_to
project_team_member_path
(
project
,
@user
),
data:
{
confirm:
remove_from_project_team_message
(
project
,
@user
)
},
remote:
true
,
method: :delete
,
class:
"btn-tiny btn btn-remove"
,
title:
'Remove user from project'
do
=
link_to
project_team_member_path
(
project
,
@user
),
data:
{
confirm:
remove_from_project_team_message
(
project
,
@user
)
},
remote:
true
,
method: :delete
,
class:
"btn-tiny btn btn-remove"
,
title:
'Remove user from project'
do
%i
.fa.fa-times
%i
.fa.fa-times
#ssh-keys
.tab-pane
-
if
@ssh_keys
.
any?
.panel.panel-default
%table
.table
%thead
.panel-heading
%tr
%th
Title
%th
Fingerprint
%th
%tbody
-
@ssh_keys
.
each
do
|
key
|
%tr
%td
=
link_to
user_key_admin_user_path
(
@user
,
key
)
do
%strong
=
key
.
title
%td
%span
(
#{
key
.
fingerprint
}
)
%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"
-
else
.nothing-here-block
User has no ssh keys
config/routes.rb
View file @
492f3a47
...
@@ -84,6 +84,8 @@ Gitlab::Application.routes.draw do
...
@@ -84,6 +84,8 @@ Gitlab::Application.routes.draw do
put
:team_update
put
:team_update
put
:block
put
:block
put
:unblock
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'
delete
'remove/:email_id'
,
action:
'remove_email'
,
as:
'remove_email'
end
end
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