Skip to content
Snippets Groups Projects
Commit 492f3a47 authored by Marin Jankovski's avatar Marin Jankovski
Browse files

Add user key actions to admins.

parent 75043a9e
No related branches found
No related tags found
1 merge request!8686add "Uplaod" and "Replace" functionality
Loading
Loading
@@ -11,6 +11,7 @@ class Admin::UsersController < Admin::ApplicationController
def show
@personal_projects = user.personal_projects
@joined_projects = user.projects.joined(@user)
@ssh_keys = user.keys.order('id DESC')
end
 
def new
Loading
Loading
@@ -107,6 +108,27 @@ 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
Loading
Loading
@@ -118,7 +140,7 @@ class Admin::UsersController < Admin::ApplicationController
:email, :remember_me, :bio, :name, :username,
:skype, :linkedin, :twitter, :website_url, :color_scheme_id, :theme_id, :force_random_password,
: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
Loading
Loading
@@ -20,6 +20,8 @@
%a{"data-toggle" => "tab", href: "#groups"} Groups
%li
%a{"data-toggle" => "tab", href: "#projects"} Projects
%li
%a{"data-toggle" => "tab", href: "#ssh-keys"} SSH keys
 
.tab-content
#account.tab-pane.active
Loading
Loading
@@ -217,3 +219,28 @@
- 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
%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
Loading
Loading
@@ -84,6 +84,8 @@ Gitlab::Application.routes.draw 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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment